A module path uniquely identifies a Go module and provides the import path prefix for its packages. For a module hosted on GitHub or GitLab, match the path to the repository location so the Go command can fetch it. In a repository containing multiple modules, include each module’s subdirectory in its path. section 11.1
cd domain go mod init github.com/YOUR_USERNAME/go-news/domain
Initialize the domain module with a path that includes its repository and subdirectory. The command creates a go.mod file declaring that path. section 11.1
Dependencies are recorded in go.mod with a module path and version. Use go get with a package path to add a dependency, or add an import and run go mod tidy. Major versions use a path suffix such as /v2 or /v3. section 11.1
cd storage go mod init github.com/YOUR_USERNAME/go-news/storage go get github.com/YOUR_USERNAME/go-news/domain@v0.0.1 go get go.etcd.io/bbolt@v1.3.11
The storage module has its own path and adds the domain module at a specific version. section 11.2
In a multimodule repository, prefix a version tag with the module’s subdirectory. For example, domain/v0.0.1 identifies the domain module’s release, rather than a release of the repository as a whole. section 11.2
cd domain git add . git commit -m "Initial domain module with core entities and interfaces" git tag domain/v0.0.1 git push origin domain/v0.0.1
Commit, tag, and push the domain module’s initial version using its subdirectory prefix. section 11.2
