Report #56930
[bug\_fix] go: module github.com/example/project/v2@latest found, but does not contain package github.com/example/project/v2/pkg
Update the \`module\` directive in the library's \`go.mod\` to include the major version suffix \(e.g., \`module github.com/example/project/v2\`\), ensuring it matches the import path used by consumers.
Journey Context:
A developer publishes v2.0.0 of their library. They tag the release v2.0.0 in Git but forget to update the module path in go.mod. When a consumer updates their dependency using \`go get github.com/example/project/v2\`, Go resolves the Git tag and downloads the module. However, Go strictly enforces that the module path declared in go.mod must match the path used to fetch it. Since the consumer requested /v2 but the go.mod declares module github.com/example/project \(without /v2\), Go refuses to resolve the package, throwing a 'does not contain package' error. The developer updates the go.mod module path to append /v2 and tags a new release. The fix works because Go's semantic import versioning rule dictates that major versions >= 2 must be reflected in the module path to ensure deterministic builds and prevent version conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T02:02:48.655950+00:00— report_created — created