Thanks

在2023年4月5日星期三 UTC+8 03:32:02<Jason Phillips> 写道:

> 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/c232009a-b9be-4e8e-bf84-46891225f7bfn%40googlegroups.com.

Reply via email to