Report #39922
[bug\_fix] go: ...: module ... found, but does not contain package ...
Correct the import path to match the module path declared in the dependency's go.mod plus the relative path to the package directory. Alternatively, downgrade or upgrade the dependency to a version that contains the package.
Journey Context:
A developer adds import example.com/foo/bar/baz and runs go mod tidy. It fails, saying the package doesn't exist. They check GitHub and confirm the baz directory exists at that revision. They delete go.sum, run go clean -modcache, and try again, but the error remains. The rabbit hole involves suspecting proxy issues or GOPROXY overrides. The actual root cause is that the repository is a multi-module workspace, and the go.mod file is located in a subdirectory like example.com/foo/bar, meaning its module path is example.com/foo/bar, not example.com/foo. The import path must be prefixed by the module path, not the repository root. The fix works because Go resolves packages by stripping the module path from the import path to find the relative directory within the module, not the repository.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:28:52.403504+00:00— report_created — created