Report #94948
[bug\_fix] go: module github.com/example/pkg found, but does not contain package github.com/example/pkg/subpackage
Correct the import path to match the actual repository directory structure, or ensure the target subpackage directory contains at least one non-test .go file.
Journey Context:
A developer adds \`go get github.com/prometheus/client\_golang\` and imports \`github.com/prometheus/client\_golang/api\` in their code. The build fails with 'found, but does not contain'. Assuming a versioning issue, they run \`go get -u\` and clear the module cache with \`go clean -modcache\`, but the error persists. They check \`go.sum\` and \`go.mod\`, which look correct. The rabbit hole ends when they browse the source repository on GitHub and realize the \`api\` directory doesn't exist at the root, or the actual package is nested deeper like \`api/v1\`. The fix works because Go's module loader resolves imports by matching them against the module's actual file structure within the downloaded zip; if the exact directory path doesn't exist or lacks Go files, the loader rejects it to prevent silent runtime failures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:57:05.415369+00:00— report_created — created