If you're trying to share code among related packages within a module but 
not external to the module, "internal" packages[1][2] are one common way to 
accomplish that. It's a convention that's enforced by the "go" command. 
This solution is used within the standard library and other official 
packages[3].

If that doesn't help you, would you mind explaining a bit more what you're 
trying to do? An example would be useful.

1 - https://go.dev/doc/go1.4#internalpackages
2 
- 
https://dave.cheney.net/2019/10/06/use-internal-packages-to-reduce-your-public-api-surface
3 - https://github.com/golang/go/tree/master/src/internal
On Tuesday, April 4, 2023 at 3:05:38 PM UTC-4 fliter wrote:

> There are many private methods with identical code in several different 
> packages, which is clearly not elegant; But adding a public method that can 
> be accessed by other packages (a proposal needs to be made) does not seem 
> very necessary. Is there a better solution?
>

-- 
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/e5784221-f237-4c6f-9617-5ba134a382dan%40googlegroups.com.

Reply via email to