2 ms·
> - Go doesn't place requirements to the name of files defining a package [1]. In Go, the import path and package name are two distinct things: the import path
by ithkuil 8y ago
> - Go doesn't place requirements to the name of files defining a package [1].
In Go, the import path and package name are two distinct things: the import path locates and identifies the package, while the package name acts as the default name for scoping qualified name exported from that package.
Furthermore in Go the file names are not part of the import path: the name of the directory containing the files that together define a single package is part of the import path.
An imperfect analogy with C++ would be:
- Go import paths <-> path to the included file (header)
- Go package names <-> a namespace inside that included file.
- Go package filenames <-> sections within the included file