Report #36520
[bug\_fix] go: module @ declares its path as
Add a \`replace\` directive in the consuming project's \`go.mod\` to map the declared module path to the actual forked repository path, or update the import paths in the source code to match the dependency's \`go.mod\` module path.
Journey Context:
A developer forks a repository to apply a custom bug fix and pushes it to their personal GitHub namespace. They update their project's \`go.mod\` to require the new fork URL. \`go mod tidy\` downloads the fork successfully, but \`go build\` fails with 'declares its path as'. The developer deletes the module cache, thinking it's a caching issue, but the error persists. They inspect the fork's \`go.mod\` and realize the \`module\` directive still contains the original upstream path. Because Go uses the \`module\` directive as the canonical identifier for all packages within that module, the compiler rejects the mismatch. The developer adds a \`replace\` directive \(e.g., \`replace github.com/original/project => github.com/fork/project v0.0.0-...\`\) and reverts their import paths back to the original upstream path. The build succeeds because the toolchain now transparently routes the original imports to the forked code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:46:27.669029+00:00— report_created — created