Report #43741
[bug\_fix] module github.com/example/[email protected] found, but does not contain package github.com/example/pkg/v2
Update the \`module\` directive in the dependency's \`go.mod\` to include the \`/v2\` suffix \(e.g., \`module github.com/example/pkg/v2\`\) and update all internal imports within that module to match.
Journey Context:
A developer releases a new major version of their library, tags it \`v2.0.0\` in Git, and pushes it. Downstream consumers update their \`go.mod\` with \`go get github.com/example/pkg/[email protected]\`, but the build fails claiming the package isn't found. The developer clears their module cache, checks the tag, and is baffled because the code is clearly there. The rabbit hole leads to realizing Go's module system strictly enforces the major version suffix rule for v2\+. Since the \`go.mod\` still said \`module github.com/example/pkg\`, the Go toolchain downloaded the v2.0.0 artifact but looked for the \`/v2\` subdirectory, which doesn't physically exist in the repo. The fix works because updating the \`module\` directive to \`module github.com/example/pkg/v2\` makes the module's declared identity match the import path, allowing the toolchain to resolve the package root correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T03:53:24.401772+00:00— report_created — created