Report #78399
[bug\_fix] go: @v2.0.0: invalid version: module contains a go.mod file, so major version must be compatible
Append the major version suffix to the module path in the dependency's go.mod file \(e.g., \`module example.com/module/v2\`\) and update all internal import paths to include the \`/v2\` suffix. Consumers must then import it as \`example.com/module/v2\`.
Journey Context:
A library author releases a breaking change and tags it as \`v2.0.0\` in git. A consumer tries to update their dependency using \`go get example.com/[email protected]\` and hits this error. The author checks the git tag and it looks perfectly valid. The rabbit-hole involves reading up on Go's versioning philosophy. The root cause is Go's import compatibility rule: packages with different major versions must have different import paths. If a module has a go.mod file and is version v2 or higher, its module path must end with the major version \(e.g., \`/v2\`\). Without this suffix, Go's minimal version selection algorithm and package loader cannot distinguish v2 from v1, leading to ambiguous builds. The fix requires the library author to update the module path in go.mod and all source files, 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-21T14:11:02.977882+00:00— report_created — created