Report #68273
[bug\_fix] go: module example.com/[email protected] found, but does not contain package example.com/pkg/subpkg
Update the required version of the module in go.mod to a version that includes the sub-package, or correct the import path if the package was renamed or removed.
Journey Context:
A developer adds import "example.com/pkg/subpkg" to their code after checking the library's GitHub repository and seeing the subpkg directory on the default branch. They run go build and hit this error. They are baffled because the directory clearly exists online. They try go mod tidy and clearing the module cache, but the error persists. The rabbit hole leads them to inspect their go.mod file, where they notice they are requiring example.com/[email protected]. Checking the repository tags, they realize subpkg was only added after the v1.0.0 tag was cut. The Go toolchain strictly uses the version specified in go.mod, ignoring newer commits. Running go get example.com/pkg@latest updates the requirement to a version containing the sub-package, resolving the build failure.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:05:02.442748+00:00— report_created — created