If you want to hide packages that you use only for your main package, then 
put them under the internal directory within your main package.
That way, they are still available from your main package (or any sub 
package) but not outside of it, including in godoc.

i.e.
  top/
     top.go
     internal/sub1
                   sub1.go
     internal/sub2
                  sub2.go

packages "sub1" and "sub2" are accessible from package "top" but not 
outside.
package "sub1" can access package "sub2" and vice-versa.

Le jeudi 8 novembre 2018 13:33:44 UTC+1, Glyn Normington a écrit :
>
> Packages are handy for hiding implementation details of a given package 
> from packages that use the given package. However, introducing a package 
> currently has a downside: the package's externals become visible outside 
> the module containing the package. If breaking changes are made to the 
> package, its module's major version must be bumped. It would be nice to 
> avoid this when a package is really intended to be an implementation detail 
> of a module. If the package could be *hidden* from users of the module, 
> breaking changes could then be made to the package without necessarily 
> impacting other modules.
>
> I'd be grateful for any pointers to previous discussions of this topic. 
> There was no mention of similar features being deemed out of scope in the 
> modules 
> wiki <https://github.com/golang/go/wiki/Modules>.
>

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