Report #64263
[bug\_fix] package ... is not in GOROOT
Ensure GO111MODULE is not set to off, and run go mod init if a go.mod file is missing, so Go fetches third-party packages instead of looking in the standard library.
Journey Context:
A developer inherits an older Go project that doesn't use Go modules \(relying on GOPATH\). They try to build it using a modern Go version, but it fails with 'package is not in GOROOT' for a third-party dependency like github.com/gin-gonic/gin. They check their GOPATH and the code is there, but Go isn't finding it. They discover that modern Go versions default to module mode, which ignores GOPATH/src. By running go env -w GO111MODULE=auto or better, go mod init to create a go.mod file, they transition the project to modules, allowing Go to properly resolve and fetch the dependencies instead of looking for them in the standard library.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T14:21:05.368458+00:00— report_created — created