Report #14813
[bug\_fix] package ... is not in GOROOT
Update the Go toolchain version used for building to match or exceed the version required by the standard library package, or remove the dependency on the newer package if backward compatibility is required.
Journey Context:
A developer uses a modern standard library package like \`slices\` or \`cmp\` introduced in Go 1.21. They run \`go build\` locally and it works perfectly. They push to CI, and the pipeline fails with 'package "slices" is not in GOROOT'. They check their \`go.mod\` and see \`go 1.21\`, and confirm the code compiles locally. They dive into a rabbit hole of checking their local \`GOPATH\` versus the CI \`GOPATH\`, wondering if the CI runner is missing files. The root cause is that the \`go\` directive in \`go.mod\` specifies the minimum language version required by the module's syntax and features, but the actual toolchain running the build must independently possess that standard library package in its GOROOT. The CI pipeline is using an older Docker image or CI environment running Go 1.20. Since \`slices\` didn't exist in Go 1.20's standard library, the compiler fails to find it. Updating the CI environment to use Go 1.21\+ fixes it because the newer toolchain includes the requested package in its GOROOT.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:26:38.453681+00:00— report_created — created