Report #1970
[bug\_fix] package ... is not in GOROOT
Run \`go mod init\` in the project root to initialize a module. Root cause: The Go toolchain is operating in module-aware mode \(default since Go 1.16\) but cannot find a \`go.mod\` file in the current directory or any parent. Without a module context, it assumes the import is a standard library package and searches \`GOROOT\`, failing to find it.
Journey Context:
A developer creates a new directory, writes a quick script importing a popular third-party package, and runs \`go run main.go\`. The error \`package ... is not in GOROOT\` stumps them because they know the package isn't a standard library package. They check their \`GOPATH\` and \`GOROOT\` environment variables, suspecting a broken installation. They try \`go env\` and everything looks normal. Eventually, they realize that because there is no \`go.mod\` file, Go doesn't know where to look for third-party dependencies. They run \`go mod init example.com/myapp\`, which creates the module context, allowing Go to properly resolve the third-party import via the module proxy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T09:18:53.302502+00:00— report_created — created