Report #3080
[bug\_fix] go: module \[...\] declares its path as: \[...\] but was required as: \[...\]
Align the import path in the source code with the \`module\` directive in the dependency's \`go.mod\` file, or update the \`replace\` directive in the host module's \`go.mod\` to correctly map the required path to the local/actual module path.
Journey Context:
A developer forks a repository to fix a bug and uses a \`replace\` directive in their \`go.mod\` to point to their local fork: \`replace github.com/original/pkg => ../local-fork\`. They run \`go build\` and get a mismatch error. The developer checks the local fork and realizes they changed the \`module\` directive in the fork's \`go.mod\` to \`github.com/forked/pkg\` to differentiate it, but their source code still imports \`github.com/original/pkg\`. The Go module system strictly enforces that the import statement, the \`require\` directive, and the dependency's \`module\` directive must form a perfect chain. If the local fork's \`go.mod\` says \`module github.com/forked/pkg\`, Go expects the import to match that. The fix is to revert the \`module\` directive in the local fork back to \`github.com/original/pkg\` so it matches the import, or change the import and require statements to match the new fork path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T15:21:03.088929+00:00— report_created — created