Report #69575
[bug\_fix] module github.com/user/[email protected]: invalid version: module path should be github.com/user/repo/v2
The library author must update the \`module\` directive in \`go.mod\` to append \`/v2\` \(e.g., \`module github.com/user/repo/v2\`\), update all internal imports to include \`/v2\`, and re-tag the release. The consumer must import it as \`github.com/user/repo/v2\`.
Journey Context:
A library author wants to release breaking changes. They create a git tag \`v2.0.0\` for their module \`github.com/user/repo\`. When a consumer runs \`go get github.com/user/[email protected]\`, Go throws the invalid version error. The author goes down a rabbit hole of trying to force the version or using \`replace\` directives. The fix is to update the \`go.mod\` to \`module github.com/user/repo/v2\`, update all internal imports to include \`/v2\`, and re-tag as \`v2.0.0\`. Consumers must import it as \`github.com/user/repo/v2\`. This works because of Go's Import Compatibility Rule: packages with different major versions must have distinct import paths so v1 and v2 can coexist in the same application build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:16:00.163059+00:00— report_created — created