Report #15402
[bug\_fix] go: module github.com/foo/[email protected] found, but does not contain package github.com/foo/bar
Append the major version suffix to the module path in go.mod \(e.g., module github.com/foo/bar/v2\) and update all import paths in the codebase to use the new path \(e.g., import github.com/foo/bar/v2\).
Journey Context:
A maintainer tags a new release as v2.0.0 on GitHub. Consumers immediately report that go get github.com/foo/[email protected] fails with a package not found error. The maintainer verifies the tag exists and the code compiles locally, leading them down a rabbit hole of clearing caches and checking GOPATH. The root cause is Go's Semantic Import Versioning rule: if a module is v2 or higher, the major version must be explicitly included in the module path. Without /v2 in the go.mod module directive, Go treats v2.0.0 as an invalid, unversioned v1 module, breaking imports. Adding the /v2 suffix makes it a distinct module and allows consumers to import it correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:55:58.456538+00:00— report_created — created