Last but not least, for debugging a value x, this gets you type and value quickly:
fmt.Printf("type is %T and value is %#v\n", x, x) On Monday, December 10, 2018 at 8:14:47 PM UTC-6, Mark Volkmann wrote: > > Here is some code that shows a part of what I'm trying to do. > https://goplay.space/#8piYtjsqveZ > > package main > > import ( > "fmt" > "reflect" > ) > > type Shape interface { > Area() float64 > Rotate(angle float64) > Translate(x, y float64) > } > > func ReportInterface(intfPtr interface{}) { > fmt.Println("type is", reflect.TypeOf(intfPtr)) // *main.Shape > value := reflect.ValueOf(intfPtr) > fmt.Println("value is", value) // <nil> > fmt.Println("method count is", value.NumMethod()) // 0, Why not 3? > } > > func main() { > var ptr *Shape > ReportInterface(ptr) > } > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.