Report #638
[bug\_fix] module declares its path as github.com/original/lib but was required as github.com/yourname/fork
Update the forked repository's go.mod so its \`module\` directive matches the path consumers require \(e.g., \`module github.com/yourname/fork\`\), and update all internal import paths in the fork to use that new prefix. Alternatively, if you are only patching upstream, require the module under its original path and use a \`replace\` directive pointing to the local fork. The root cause is that Go validates the \`module\` directive inside a downloaded go.mod against the path requested in \`require\`; a mismatch is treated as a corrupt module identity.
Journey Context:
You fork a popular library on GitHub to patch a bug and change your project's go.mod to require \`github.com/yourname/fork\`. \`go mod tidy\` downloads the zip, then aborts with "module declares its path as: github.com/original/lib but was required as: github.com/yourname/fork". You try pseudo-versions, \`replace\` directives, and even \`GOPROXY=direct\`, but the error persists because the source of truth is the \`module\` line inside the fork's go.mod, which still claims the old identity. After checking the extracted module cache you realize the fork was never converted to its own module path. The fix works because the module directive is Go's canonical name for a module; every import path in that module must have it as a prefix, and the go command refuses to use a module whose declared path differs from what the build graph asked for.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T10:55:42.360287+00:00— report_created — created