func showShapeDetails(shape shapes.Shaper) { fmt.Print("fill=", shape.Fill(), " ") // All shapes have a fill color if shape, ok := shape.(shapes.CircularShaper); ok { // shadow variable fmt.Print("radius=", shape.Radius(), " ") if shape, ok := shape.(shapes.RegularPolygonalShaper); ok { //shadow fmt.Print("sides=", shape.Sides(), " ") } } fmt.Println() }
func sanityCheck(name string, shape shapes.Shaper) { fmt.Print("name=", name, " ") fmt.Print("fill=", shape.Fill(), " ") if shape, ok := shape.(shapes.CircularShaper); ok { fmt.Print("radius=", shape.Radius(), " ") if shape, ok := shape.(shapes.RegularPolygonalShaper); ok { fmt.Print("sides=", shape.Sides(), " ") } } fmt.Println() }