Hello,

I would like to get the name of the struct implementing an interface (using 
a method in the interface). I could just have the MyInterface.StructName() 
method in each implementing struct which just did a return "myname" but I 
would prefer to do this using reflection and without having to replicate 
the same method in all implementations,  I have tried using an embedded 
struct here[1], but it prints the name of the embedded struct. Is there a 
way to do this? 

Why: I have multiple implementations and want to be able to record which 
implementation was used.

Thanks,
Glen


[1]https://play.golang.org/p/CiXIzzLBHOI

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/55161a31-7f8f-4aae-82d0-6b19096cff9b%40googlegroups.com.

Reply via email to