Report #45360
[bug\_fix] go: [email protected]: invalid version: module path ... doesn't match major version suffix
Append the major version suffix \(e.g., \`/v2\`\) to the module path in the dependency's \`go.mod\` file, and update all import statements in the consuming code to use the suffixed path.
Journey Context:
A developer maintains a library and decides to release a breaking change, tagging it as \`v2.0.0\` in Git. They push the tag and update their consumers by running \`go get example.com/[email protected]\`. The command fails with the version suffix error. The developer goes down a rabbit hole of trying to force the version, deleting and re-creating tags, or using \`replace\` directives, assuming the Go tooling has a bug with semantic versioning. They don't understand why v1 works fine but v2 doesn't. The root cause is Go's Semantic Import Versioning rule: any module with a major version of 2 or higher MUST include the major version in the module path itself \(e.g., \`example.com/lib/v2\`\). This ensures the v2 module is treated as a completely distinct package from v1, allowing both to coexist in the same build. The fix requires updating the library's \`go.mod\` module declaration and all its internal imports, then tagging 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-19T06:36:33.488742+00:00— report_created — created