How's the visibility of members from a sub-package to its root package?
This is what I mean:
foo // the "root" package
foo/utils // a sub-package
foo/tools // another sub-package
Can foo
access private members of foo/utils
and foo/tools
or do they act as separate, independant packages?
Go has no concept of sub-directories nor sub-packages. Packages are separate from each other. The import path "foo/utils"
is just an import path (a method of how to find the package) - the string "foo/utils"
has no significance other than locating the package on local disk or in the Internet.
foo
cannot access private members of foo/utils
.
In Go1, each directory in a source tree corresponds to a single package. More about this can be found here: the go command.