In Go there is no way to pass a reference to an instance of the 
container/enclosing type, to a function of an embedded type. What work 
around do you use for this? Any idiomatic Go way?

Currently I model the shared functionality using an interface. Then the 
implementation is another struct, which takes a pointer to the container 
type and implements that interface - one could just implement the interface 
directly. But this is done for convenience and grouping the similar 
functionality. This implementation struct will then gets embedded inside 
the container/enclosing type.

-- 
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.

Reply via email to