#Adding a method on a struct from another package
5 messages · Page 1 of 1 (latest)

that's the whole point of packages, they are meant to be self contained scopes
If you want to add a method to foo.Bar you can create a new type whose underlying type is foo.Bar and add a method to that, but it's a different type.
type foo2 foo.Bar
func(foo2) f() {}```
That said, this smells like a design problem and as such I would discourage doing this and rethink your design instead
understandable, thank you for the help