mardi 15 décembre 2015

get golang interface name dynamiclly

I have a interface:

type Printer interface{
Print(s string)
}

and a func:

func fxyz(name String) {
....
}

I want to call fxyz with "Printer", but I don't want to hard code the string . How could I get the Interface Name using reflection or other approach?





Aucun commentaire:

Enregistrer un commentaire