Report #38757
[bug\_fix] package io/ioutil is not in GOROOT
Replace all usages of the deprecated io/ioutil package with the equivalent functions in the io and os packages. Specifically, use os.ReadFile for ioutil.ReadFile, os.WriteFile for ioutil.WriteFile, os.ReadDir for ioutil.ReadDir, os.MkdirTemp for ioutil.TempDir, os.CreateTemp for ioutil.TempFile, and io.Discard for ioutil.Discard.
Journey Context:
A developer upgrades their local Go toolchain to version 1.22 or clones an older project to build with the latest Go. The build immediately fails with 'package io/ioutil is not in GOROOT'. They might try reinstalling Go, thinking their installation is corrupted, or manually creating the folder in the GOROOT directory. The rabbit hole often involves checking environment variables and Go paths. The root cause is that io/ioutil was deprecated in Go 1.16 and completely removed from the standard library in Go 1.22. The package had been a wrapper around io and os for years, and the Go team finally deleted it. The fix is not to hack the GOROOT, but to update the codebase to use the modern, direct equivalents in io and os, which have been stable and available since Go 1.16.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:31:53.351570+00:00— report_created — created