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/loop/loop_test.go b/metropolis/pkg/loop/loop_test.go
index 16ead64..7f23f3e 100644
--- a/metropolis/pkg/loop/loop_test.go
+++ b/metropolis/pkg/loop/loop_test.go
@@ -19,7 +19,6 @@
import (
"encoding/binary"
"io"
- "io/ioutil"
"math"
"os"
"runtime"
@@ -36,7 +35,7 @@
// bit unsigned integers) to detect offset correctness. File is always 128KiB
// large (2^16 * 2 bytes).
func makeTestFile() *os.File {
- f, err := ioutil.TempFile("/tmp", "")
+ f, err := os.CreateTemp("/tmp", "")
if err != nil {
panic(err)
}
@@ -183,7 +182,7 @@
if os.Getenv("IN_KTEST") != "true" {
t.Skip("Not in ktest")
}
- f, err := ioutil.TempFile("/tmp", "")
+ f, err := os.CreateTemp("/tmp", "")
assert.NoError(t, err)
empty1K := make([]byte, 1024)
for i := 0; i < 64; i++ {