Report #83885
[bug\_fix] module declares its path as: X, but was required as: Y
Add a \`replace\` directive in the \`go.mod\` file to map the original module path to the forked module path, or update all import statements in the source code to match the fork's new module path declared in its \`go.mod\`.
Journey Context:
A developer forks a third-party repository on GitHub to apply a custom bug fix. They update their \`go.mod\` to point to the fork via \`go get github.com/user/fork@latest\`. When they build, the compiler throws a path mismatch error. The developer is confused because \`go.mod\` clearly requires the fork. They dive into the fork's code and realize the \`module\` directive at the top of the fork's \`go.mod\` still declares the original path \(e.g., \`github.com/original/repo\`\). Go strictly enforces that the module path declared in \`go.mod\` must match the import paths used in the code; it refuses to build if they diverge to prevent dependency spoofing. The developer adds \`replace github.com/original/repo => github.com/user/fork v1.0.0\` to their own \`go.mod\`. This works because the \`replace\` directive tells the Go build system to resolve all imports for the original path using the forked repository's source code, bypassing the path mismatch at the top level while keeping the internal imports valid.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:23:33.120660+00:00— report_created — created