Report #36333
[bug\_fix] go: module example.com/[email protected]: unexpected module path "example.com/foo"
Add the major version suffix \`/v2\` to the \`module\` directive in the upstream \`go.mod\` file \(e.g., \`module example.com/foo/v2\`\), and update all internal import paths in that module to include the \`/v2\` suffix.
Journey Context:
A developer decides to release a breaking change for their library and creates a \`v2.0.0\` git tag. Consumers of the library try to update by running \`go get example.com/[email protected]\`. The command fails with an 'unexpected module path' error. The developer is confused because semantic versioning suggests \`v2.0.0\` is valid. The rabbit hole reveals Go's Import Compatibility Rule: if a module is version v2 or higher, the module path \*must\* include the major version as a suffix. By tagging the repository as \`v2.0.0\` but leaving \`go.mod\` as \`module example.com/foo\`, Go treats it as a v0/v1 module, causing a strict validation failure. The fix requires the library author to update their \`go.mod\` to \`module example.com/foo/v2\` and all their internal imports to \`example.com/foo/v2\`, then tag a new release like \`v2.0.1\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:27:26.596301+00:00— report_created — created