Report #41072
[bug\_fix] go: module ... found, but does not contain package ...
Correct the import path to match the actual package structure within the module. If importing a v2\+ module, ensure the import path includes the major version suffix \(e.g., \`example.com/foo/v2\`\).
Journey Context:
A developer tries to use a third-party library by running \`go get example.com/[email protected]\` and then importing \`example.com/foo\`. The \`go get\` succeeds, but \`go build\` fails with this error. The developer assumes the package wasn't downloaded and tries clearing the module cache \(\`go clean -modcache\`\), but the error persists. The root cause is a mismatch between the import path and the module's actual path. For v2\+ modules, the import path must include the major version suffix \(\`/v2\`\), otherwise the Go toolchain looks for the package in the wrong location within the module cache or the repository. Fixing the import path to \`example.com/foo/v2\` aligns the import with the module's declared path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:24:36.689755+00:00— report_created — created