Report #84342
[bug\_fix] go: module example.com/[email protected] found, but does not contain package example.com/foo/bar
Run \`go mod tidy\` to update the \`go.mod\` and \`go.sum\` files to resolve the correct version of the dependency that actually contains the required package.
Journey Context:
A developer adds an import for a specific sub-package of a third-party module \(e.g., \`example.com/foo/bar\`\). They run \`go build\` and get an error stating the module does not contain the package. The developer checks the module's GitHub repository and sees the \`bar\` package exists in the latest commit. They might try \`go get example.com/foo@latest\` or manually editing \`go.mod\` to the latest version, but the error persists or creates dependency conflicts. The root cause is that the version of the module recorded in \`go.mod\` \(perhaps an older version or a pseudo-version from before the sub-package was created\) does not contain the requested package. The \`go\` command strictly uses the version specified in \`go.mod\`. Running \`go mod tidy\` recalculates the exact versions needed to satisfy all imports, upgrading the dependency to the version where \`bar\` was introduced.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:09:41.816654+00:00— report_created — created