I'm having problems determine the type of a struct when I only have a pointer to the struct.
type TypeA struct {
Foo string
}
type TypeB struct {
Bar string
}
I have to implement the following callback:
func Callback(param interface{}) {
}
param can be *TypeA or *TypeB.
How can I determine the Type of param?
reflect.TypeOf(param) seems not to work with a pointer.
When I do this
func Callback(param interface{}) {
n := reflect.TypeOf(param).Name()
fmt.Printf(n)
}
The output is empty
Thanks in advance for any help.