Report #90414
[bug\_fix] go: module github.com/example/[email protected] found, but does not contain package github.com/example/project
Update the import path in the Go source code to include the major version suffix \(e.g., change \`github.com/example/project\` to \`github.com/example/project/v2\`\), then run \`go mod tidy\`.
Journey Context:
A developer adds a dependency using \`go get github.com/example/[email protected]\`. The \`go.mod\` file updates successfully to v2.0.0. However, when they build or test, the compiler throws 'module found, but does not contain package'. The developer might clear the module cache, delete the \`go.sum\`, or try different versions, suspecting a caching issue or a broken release. The real issue is Go's Import Compatibility Rule: for modules at v2.0.0 and above, the module path must end with the major version suffix \(e.g., \`/v2\`\). The upstream repository correctly updated their \`go.mod\` to \`module github.com/example/project/v2\`, meaning all their packages are under that \`/v2\` namespace. The developer's import statement, however, lacks the \`/v2\` suffix, pointing to a non-existent path within the v2 module. Appending \`/v2\` to the import resolves the namespace mismatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:21:18.355723+00:00— report_created — created