Report #91436
[bug\_fix] package example.com/some/package is not in GOROOT \(/usr/local/go/src\)
Ensure you are running the build from within a Go module \(a directory containing go.mod, or a subdirectory thereof\). If no go.mod exists, run \`go mod init\` to enable module-aware mode.
Journey Context:
A developer clones a repository and tries to build a specific package using \`go build example.com/some/package\` from their home directory, or they are transitioning an old GOPATH project. The compiler throws an error claiming the third-party package is not in the standard library \(GOROOT\). They are confused because the package is clearly a third-party module, not a standard library package. They check their \`GOPATH\` and \`GOROOT\` environment variables, going down a rabbit hole of Go path configuration. The root cause is that they are operating outside of any Go module root. In modern Go \(1.16\+\), module mode is the default. Without a go.mod file in the current directory or any parent, the Go toolchain falls back to a pseudo-GOPATH mode where it only looks in the vendor directory or GOROOT. Creating a go.mod file anchors the project, enabling the Go toolchain to resolve imports via the module proxy and cache instead of looking in the standard library.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:04:05.428789+00:00— report_created — created