Report #22477
[bug\_fix] go: import ... has path ... which does not match the module path declared in go.mod
Update the module directive in the dependency's go.mod to exactly match the import path, or use a replace directive in the consuming module to map the import path to the local or forked module path.
Journey Context:
A developer forks a third-party library to apply a custom bug fix. They update their go.mod to point to the fork via a replace directive or direct go get. When they try to build, the compiler throws a path mismatch error. The developer checks the import statements in their own code, which look correct for the fork. The rabbit hole begins: they try clearing the module cache, checking their Git tags, and wondering if Go is caching the old module. The actual root cause is inside the fork's go.mod: the module line still declares the original upstream path. Go's module system uses the go.mod path as the source of truth, not the Git URL. The fix is to edit the fork's go.mod to change the module path to the fork's URL, and update all import statements within the fork to match, ensuring the module identity is consistent.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:08:07.351385+00:00— report_created — created