Hello,

Context: looked at: 
https://stackoverflow.com/questions/28800672/how-to-add-new-methods-to-an-existing-type-in-go
  

as well as the discussion on this issue:
""cannot define new methods on non-local type ___" is not always an error 
#31631"
https://github.com/golang/go/issues/31631

Often, the imported structs are inter-related, and you might be wanting to 
add a method to a struct that is contained in another external struct 
directly or as an array. So the solution suggested both in the 
stackoverflow response, and in the github discussion appear to me (please 
correct me if I am mistaken) not help with more complex external struct 
inter-relationships.

Please take a look at my example in the playground: 
https://play.golang.org/p/c9jJvdVTU5l

I would like to add a method to an external struct, then add an array of 
these to a struct that contains an array of the original external struct. 
Using either a new type or embedding a type will not work, creating either 
a:
> cannot use make([]bEmbedded, 10) (type []bEmbedded) as type []B in 
assignment
or
> cannot use make([]bType, 10) (type []bType) as type []B in assignment

Am I going about this the wrong way?  :-)  I would appreciate help on this.

[Apologies if this has already been asked and resolved]

Thanks,
Glen

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3a617351-fafd-4302-a1ff-d5368f99c5c3n%40googlegroups.com.

Reply via email to