Report #9354
[bug\_fix] module ... found, but did not contain package ...
Update the import path to include the major version suffix \(e.g., change \`example.com/m/subpkg\` to \`example.com/m/v2/subpkg\`\), or verify the package actually exists in the specified version of the dependency.
Journey Context:
A developer upgrades a dependency from v1 to v2 by running \`go get example.com/[email protected]\`. Their code imports \`example.com/m/subpkg\`. The build fails with 'module example.com/m found, but did not contain package example.com/m/subpkg'. They check GitHub and see \`subpkg\` exists in the v2.0.0 tag. The rabbit hole: they try clearing the cache, deleting \`go.mod\`, and re-adding the dependency. The root cause is Go's Semantic Import Versioning rule: for major versions v2 and above, the module path \*must\* end with the major version \(e.g., \`/v2\`\). The developer updated the \`go.mod\` requirement, but didn't update the import paths in their \`.go\` files. The Go tool sees the import \`example.com/m/subpkg\` and looks in the v1 module, which doesn't have the package at v2.0.0. Updating the import to \`example.com/m/v2/subpkg\` resolves it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:52:57.250167+00:00— report_created — created