Report #6957
[bug\_fix] go: module / found, but does not contain package //
Require the submodule explicitly in go.mod using \`go get //@latest\` so the Go toolchain resolves it as a separate module.
Journey Context:
A developer tries to use a specific sub-package from a popular open-source monorepo by importing \`github.com/example-org/monorepo/subpkg\`. The build fails, claiming the package doesn't exist. The developer checks the repository on GitHub and clearly sees the \`subpkg\` directory. They go down a rabbit hole of clearing the module cache \(\`go clean -modcache\`\), checking their GOPROXY settings, and even suspecting a bad tag. They finally look inside the \`subpkg\` directory and notice it contains its own go.mod file declaring \`module github.com/example-org/monorepo/subpkg\`. The root cause is that Go resolves the import path against the root module first, finds the root module, but the root module doesn't contain the \`subpkg\` package \(it's a separate module boundary\). The fix is to realize that the submodule is an independent Go module and must be required explicitly in the consumer's go.mod using \`go get github.com/example-org/monorepo/subpkg@latest\`. This works because it instructs the Go toolchain to fetch the specific submodule's version, resolving the import path against the submodule's go.mod rather than the root module.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:23:57.822321+00:00— report_created — created