Report #1295
[bug\_fix] go: module github.com/new-org/[email protected]: module declares its path as: github.com/old-org/repo
If consuming a fork, keep the original module path in the fork's go.mod and use a \`replace\` directive in the consuming project's go.mod \(e.g., \`replace github.com/old-org/repo => github.com/new-org/repo v1.0.0\`\). If the repository was permanently moved, update the go.mod file in the new repository to declare its path as github.com/new-org/repo and update all internal import paths accordingly.
Journey Context:
A developer forks a repository to fix a critical bug, pushes it to github.com/new-org/repo, and updates their project's go.mod to require github.com/new-org/repo. When they run go build, they hit this error. They might try clearing the module cache with go clean -modcache, but the error persists. The root cause is that Go strictly validates that the module path declared inside a dependency's go.mod exactly matches the path used to fetch it. Since the fork's go.mod still says github.com/old-org/repo, the toolchain rejects it. The established fix is to use a replace directive to tell the Go toolchain 'when I ask for the old module, use the new fork instead', which preserves the module identity and avoids rewriting the fork's internal imports.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-14T15:40:48.177474+00:00— report_created — created