Report #96169
[bug\_fix] go: @vX.Y.Z used for two different module paths \( and \)
Ensure the module directive in the local replacement's go.mod exactly matches the module path specified on the left side of the replace directive in the root module.
Journey Context:
A developer uses a replace directive in their go.mod to point a dependency to a local fork \(e.g., replace example.com/lib => ../lib\). When they run go build, they get a cryptic error about the module being used for two different paths. They might try deleting the go.sum, changing the version in the replace directive, or removing the require line, but the error persists. The root cause is that the go.mod file inside ../lib declares a module path \(e.g., github.com/original/lib\) that differs from the path on the left side of the replace directive \(e.g., example.com/lib\). The Go toolchain strictly enforces that the replacement's declared identity matches the identity it is replacing. The fix works because aligning the module path in the local go.mod satisfies the toolchain's identity verification, allowing it to seamlessly swap the remote dependency for the local code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T20:00:05.888453+00:00— report_created — created