This is so simple that I can't believe that is so difficult to find. Basically I want to pass reflect.Type
to a function, but I want to extract it from struct definition instead of instance. So:
type MyType struct {
a int
}
func myFunction(t reflect.Type) {
...
}
And I would like to call equivalent to Java's:
myFunction(SomeOfMyClass.class)
So I don't have an instance of MyType but I need to pass its type to the function.
Aucun commentaire:
Enregistrer un commentaire