Report #96525
[bug\_fix] go: module example.com/foo/v2: module path "example.com/foo" does not match major version suffix
Update the \`module\` directive in the repository's \`go.mod\` file to include the \`/v2\` suffix \(e.g., \`module example.com/foo/v2\`\), and update all internal import paths within that repository to use the \`/v2\` suffix.
Journey Context:
A developer creates a new major version of their library, tags it as \`v2.0.0\` in git, and pushes it. When consumers attempt to \`go get example.com/foo/v2\`, the command fails with a module path mismatch. The developer is confused because the git tag exists and the code hasn't changed paths. The root cause is Go's strict adherence to Semantic Import Versioning: if a module is versioned v2 or higher, the module path itself must reflect that major version. The Go toolchain refuses to resolve the module because the requested path \(\`/v2\`\) does not match the declared path in \`go.mod\`. Updating the \`go.mod\` module declaration and all internal imports to append \`/v2\` aligns the module path with its version, allowing the toolchain to resolve it correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:35:56.981565+00:00— report_created — created