tree-wide: rewrite ioutil functions to their replacements
The ioutil package has been deprecated in Go 1.16 [1]. This CL removes
all our own users of that package and rewrites them to use their
replacements in the os package. I initially wanted to do this with a
gofix but because all replacements were signature-compatible I just
did it with a few string replaces and then ran goimports to fix up the
imports.
I intentionally didn't rewrite the patches as that would require a
different process and is IMO of less value.
[1] https://github.com/golang/go/issues/42026
Change-Id: Iac6663a1f1ee49f9b1c6e4b3d97e73f2c3b54a13
Reviewed-on: https://review.monogon.dev/c/monogon/+/449
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/metropolis/pkg/fsquota/fsquota_test.go b/metropolis/pkg/fsquota/fsquota_test.go
index 392a0e9..c842b63 100644
--- a/metropolis/pkg/fsquota/fsquota_test.go
+++ b/metropolis/pkg/fsquota/fsquota_test.go
@@ -18,7 +18,6 @@
import (
"fmt"
- "io/ioutil"
"math"
"os"
"os/exec"
@@ -120,7 +119,7 @@
t.Fatal(err)
}
sizeFileData := make([]byte, 512*1024)
- if err := ioutil.WriteFile("/test/readback/512kfile", sizeFileData, 0644); err != nil {
+ if err := os.WriteFile("/test/readback/512kfile", sizeFileData, 0644); err != nil {
t.Fatal(err)
}
@@ -138,7 +137,7 @@
// Write 50 inodes for a total of 51 (with the 512K file)
for i := 0; i < 50; i++ {
- if err := ioutil.WriteFile(fmt.Sprintf("/test/readback/ifile%v", i), []byte("test"), 0644); err != nil {
+ if err := os.WriteFile(fmt.Sprintf("/test/readback/ifile%v", i), []byte("test"), 0644); err != nil {
t.Fatal(err)
}
}