Report #76178
[bug\_fix] module ... declares its path as: ... but was required as: ...
Update the import path in the source code or the \`require\` directive in \`go.mod\` to exactly match the module path declared in the dependency's \`go.mod\` file. If using a fork, update the fork's \`go.mod\` to reflect its new repository path, or use a \`replace\` directive mapping the original path to the fork.
Journey Context:
A developer forks a repository to fix a bug and updates their project's \`go.mod\` to point to their fork using a \`replace\` directive or by changing the \`require\` path. When they run \`go build\`, the compiler throws a module path mismatch error. They spend hours checking git tags, clearing the module cache with \`go clean -modcache\`, and re-running \`go mod tidy\`, assuming the toolchain is fetching the wrong repository. The real root cause is that Go strictly enforces that the import path, the \`require\` path, and the dependency's own \`module\` directive must all match. The forked repository still contains the original \`go.mod\` declaring the upstream module path. The fix is to either change the fork's \`go.mod\` to match its new URL, or use a \`replace\` directive that maps the original module path to the fork's repository URL.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:27:43.966741+00:00— report_created — created