Report #30134
[bug\_fix] go: module example.com/foo/[email protected] found, but does not contain package example.com/foo/bar \(module path mismatch\)
Update the import path in the Go source code to include the major version suffix, matching the module's declared path in its go.mod \(e.g., change \`import "example.com/foo/bar"\` to \`import "example.com/foo/bar/v2"\`\).
Journey Context:
A developer runs \`go get example.com/foo/[email protected]\` and it succeeds, adding the dependency to go.mod. However, upon building, the compiler complains about a missing package or module path mismatch. The developer inspects the go.mod file and sees \`example.com/foo/bar/v2\` declared by the upstream module, but their local import statement lacks the \`/v2\`. They might try \`go get\` again or delete the cache, but the error persists. The root cause is Go's strict Semantic Import Versioning rule: if a module is v2 or higher, its module path must end in the major version suffix, and all import paths consuming it must also include that suffix. The fix works because the Go tooling strictly enforces that the import path exactly matches the module's declared path to guarantee import compatibility across major versions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:58:04.797093+00:00— report_created — created