Report #10895
[bug\_fix] go: module MODULE found, but does not contain package PACKAGE
Change the import path in the source code to point to the actual subdirectory containing the Go package, rather than the repository or module root.
Journey Context:
A developer wants to use a popular library and imports the repository root \(e.g., \`import "github.com/golang/protobuf"\`\). When they run \`go build\`, it fails, stating the module was found but does not contain the package. The developer verifies the repository exists and the version is correct, leading them to think the module is broken. The root cause is a misunderstanding of Go's module vs. package model: a module is a collection of packages defined by a \`go.mod\` file at the root, but a package must have \`.go\` files in its directory. The repository root in this case has no \`.go\` files with \`package protobuf\`; the actual code resides in subdirectories. The fix is to update the import path to the specific package subdirectory \(e.g., \`import "github.com/golang/protobuf/proto"\`\), which tells the Go toolchain exactly where to find the package within the module.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:55:24.675845+00:00— report_created — created