Report #41068
[bug\_fix] package io/fs is not in GOROOT
Update the \`go\` directive in \`go.mod\` to the Go version that introduced the package \(e.g., \`go 1.16\` for \`io/fs\`\), and ensure the local Go toolchain is updated to at least that version.
Journey Context:
A developer writes code using a newer standard library package like \`io/fs\` on their local machine running Go 1.21. The code compiles perfectly. However, when pushed to CI or another environment, the build fails with \`package io/fs is not in GOROOT\`. The developer is baffled because the package clearly exists in the standard library. The rabbit hole involves checking the CI's Go installation path and environment variables. The root cause is often that the \`go.mod\` file specifies an older Go version \(e.g., \`go 1.15\`\), and the Go toolchain \(especially with module mode and toolchain selection\) restricts the available standard library to what existed in that declared version, or the CI is literally running an older Go version. Updating the \`go\` directive in \`go.mod\` tells the toolchain to use the newer standard library.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:24:10.442512+00:00— report_created — created