Report #59561
[bug\_fix] go: [email protected]...: go.mod file indicates module ... but directory indicates ...
Ensure the \`module\` path declared in the \`go.mod\` file of the local replacement exactly matches the module path specified in the \`replace\` directive.
Journey Context:
A developer uses a \`replace\` directive in their \`go.mod\` to point a dependency to a local fork on their filesystem: \`replace github.com/foo/bar => ../local-bar\`. When they build, they get an error stating the go.mod file indicates one module path, but the directory indicates another. They check the \`go.mod\` of the local fork and see it says \`module github.com/foo/bar/v2\`. The \`replace\` directive doesn't just swap the source; it expects the module identity to match. The root cause is that the module path in the local directory's \`go.mod\` doesn't match the module path on the left side of the \`replace\` directive. The fix is to either change the local \`go.mod\` to \`module github.com/foo/bar\`, or update the \`replace\` directive to \`replace github.com/foo/bar/v2 => ../local-bar\` and update all imports accordingly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:27:41.958159+00:00— report_created — created