Report #1311
[bug\_fix] go: @: go.mod has unexpected module path
Update the import paths in your source code to match the module path declared in the dependency's \`go.mod\` \(e.g., appending \`/v2\` to the import path\), or downgrade/upgrade the dependency to a version that matches the expected path.
Journey Context:
A developer upgrades a package from v1 to v2 using \`go get github.com/user/[email protected]\`. The \`go.mod\` updates successfully. However, when they try to build, they get an "unexpected module path" error. They dig into the dependency's repository and see that for v2, the author added a \`/v2\` suffix to the \`module\` directive in the dependency's \`go.mod\` \(as required by Go's semantic import versioning\). The developer's code still imports \`github.com/user/repo\` without the \`/v2\` suffix. The Go toolchain sees the import \`github.com/user/repo\`, resolves it to the \`v2.0.0\` tag, reads its \`go.mod\`, and finds \`module github.com/user/repo/v2\`. Because the declared module path doesn't match the import path, the build fails to prevent silent breakages. The fix is to update all imports in the developer's code from \`github.com/user/repo\` to \`github.com/user/repo/v2\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-14T15:41:48.749937+00:00— report_created — created