Report #14224
[bug\_fix] go: [email protected]\+incompatible: module ... should have .../v2 as import path
Append the major version suffix \(e.g., \`/v2\`\) to the module path in the \`module\` directive of the dependency's \`go.mod\`, and update all import paths within that module to include \`/v2\`. In the consuming project, import it as \`github.com/foo/bar/v2\`.
Journey Context:
A developer tries to update a dependency from \`v1.5.0\` to \`v2.0.0\`. They change their \`go.mod\` to require \`v2.0.0\` and run \`go mod tidy\`. The tool resolves it as \`v2.0.0\+incompatible\`, but they start getting compilation errors or the \`go\` tool warns them about the import path. They read the documentation and discover the 'Import Compatibility Rule': if a module's major version is 2 or higher, the major version must be included in the module path \(e.g., \`/v2\`\). The dependency author released \`v2.0.0\` without updating the module path, breaking the Go module convention. They either reach out to the author to fix it, or they are the author and they update their \`module\` directive and all internal imports to include \`/v2\`. The fix works because Go's minimal version selection and module system rely on the major version suffix to treat \`v2\` as a completely distinct module from \`v1\`, allowing them to coexist in the same build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:55:26.395994+00:00— report_created — created