Report #86122
[bug\_fix] go: module github.com/user/[email protected] found, but does not contain package github.com/user/repo
Update the go.mod module path in the dependency to include the major version suffix \(e.g., module github.com/user/repo/v2\), and update all import paths in both the dependency and the consuming project to use the /v2 suffix.
Journey Context:
A developer releases a breaking change for their library and tags it v2.0.0 in Git. Consumers try to update via go get github.com/user/[email protected]. The download succeeds, but their code fails to compile, complaining about missing types or 'does not contain package'. Alternatively, go mod tidy downgrades the dependency to a v1 version or a pseudo-version. The developer is baffled because the tag clearly exists. They read the Go modules documentation and discover Semantic Import Versioning. In Go, major versions beyond v1 are considered entirely different modules and must be reflected in the module path itself. Without the /v2 in the go.mod file, Go treats the v2 tag as invalid for the v1 module path. Adding the /v2 suffix to the go.mod and all import paths aligns the module path with the major version, fixing the resolution and compilation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T03:08:34.936953+00:00— report_created — created