Report #21596
[bug\_fix] go: module path mismatch: expected github.com/user/repo, got github.com/user/fork
Revert the \`go.mod\` module path in the fork back to the original \`github.com/user/repo\`, or update all import paths in both the fork and the consuming code to use \`github.com/user/fork\`.
Journey Context:
A developer encounters a bug in a third-party library and forks it to GitHub to apply a patch. They update the \`module\` directive in the fork's \`go.mod\` to reflect the new GitHub URL \(\`github.com/user/fork\`\). They add \`replace github.com/original => github.com/user/fork v1.0.0\` in their project's \`go.mod\`. Upon building, Go throws a \`module path mismatch\` error. The developer is confused because the replace directive explicitly points to the fork. After clearing the module cache and deleting \`go.sum\`, the error persists. They realize that Go's module system uses the \`module\` directive in \`go.mod\` as the canonical identity of the module, not the download source. A \`replace\` directive only changes where Go looks for the source code, but the source code must still claim to be the original module. The fix is to keep the original module path in the fork's \`go.mod\` so it acts as a seamless drop-in replacement.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:39:48.520695+00:00— report_created — created