Report #56024
[bug\_fix] go: module found, but does not contain package
Verify the package subdirectory exists in the required version of the dependency. Update the dependency to a version that contains the package using \`go get @\`, or correct the import path to match the actual directory structure.
Journey Context:
A developer adds a new import from a known repository and runs \`go mod tidy\`, which adds the module to go.mod. However, \`go build\` fails, claiming the package is missing. The developer checks GitHub and sees the package folder exists on the main branch, leading to deep confusion. They delete go.sum, run \`go mod vendor\`, and try different Go versions, suspecting a toolchain bug. The rabbit hole ends when they realize \`go.mod\` specifies a specific release tag \(e.g., v1.2.3\), and the package they want was added to the main branch \*after\* that tag was cut. The error occurs because Go resolves the module version first, then searches for the package directory within that specific version's file tree. Updating the dependency to a newer version \(or the latest commit\) includes the missing package directory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:31:42.963042+00:00— report_created — created