Report #62209
[bug\_fix] module ... declares its path as ... but was imported as ...
Align the module directive in the dependency's go.mod file to match the import path used to fetch it, or change the import path to match the module directive. If using a replace directive, ensure the replacement module path matches the original module path.
Journey Context:
A developer forks a repository and updates their go.mod with a replace directive pointing to their fork. They run go build and hit the 'declares its path as' error. They assume the replace directive is broken or that Go is caching the old module. They clear the module cache and delete go.sum, but the error persists. They eventually realize that Go validates the module directive in the dependency's go.mod against the import path. Since the forked repo's go.mod still says 'module github.com/original/repo', but it's being imported as 'github.com/developer/fork', Go strictly rejects it. Updating the module directive in the fork to match the new import path fixes the strict validation check and allows the build to proceed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:54:15.512644+00:00— report_created — created