Report #49428
[bug\_fix] go: module ... found, but does not contain package ...
Update the import path in the source code to include the major version suffix \(e.g., change \`import "example.com/foo"\` to \`import "example.com/foo/v2"\`\) so it matches the module path defined in the dependency's \`go.mod\` file.
Journey Context:
A developer adds a dependency using \`go get example.com/[email protected]\`. The \`go.mod\` updates correctly to require \`example.com/foo/v2\`. However, their code still imports \`example.com/foo\` without the version suffix. The build fails with 'module found, but does not contain package'. The developer initially suspects a proxy issue or a corrupted cache, so they clear the module cache and delete \`go.sum\`, but the error persists. They examine the dependency's repository and notice its \`go.mod\` declares \`module example.com/foo/v2\`. The root cause is that Go's minimal version selection requires the major version suffix in the import path for versions v2.0.0 and above to maintain import compatibility rules. By updating all import statements to include the \`/v2\` suffix, the compiler correctly resolves the package within the v2 module, and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:27:08.167894+00:00— report_created — created