Report #57511
[bug\_fix] go: [email protected]: ... does not contain package ... \(module path mismatch in fork\)
Update the module directive in the forked repository's go.mod file to match the fork's new import path, and update all internal imports within the fork accordingly.
Journey Context:
A developer forks a public repository to fix a bug. They push the fix to github.com/dev/fork and update their main application's go.mod to point to the fork. go build fails, claiming the package does not exist or the original repository is fetched instead. The developer tries replace directives but struggles with transitive dependencies. The root cause is that the go.mod file in the fork still declares module github.com/original/repo. The Go toolchain uses the module directive as the canonical identity. When the application imports github.com/dev/fork, Go sees the go.mod claims to be github.com/original/repo and either rejects it or fetches the original. Changing the module path in the fork aligns its identity with its new location.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:01:10.434900+00:00— report_created — created