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/cli/dbg/main.go b/metropolis/cli/dbg/main.go
index 84df60d..99aff6c 100644
--- a/metropolis/cli/dbg/main.go
+++ b/metropolis/cli/dbg/main.go
@@ -21,7 +21,6 @@
"flag"
"fmt"
"io"
- "io/ioutil"
"math/rand"
"os"
"strings"
@@ -142,7 +141,7 @@
case "kubectl":
// Always get a kubeconfig with cluster-admin (group system:masters),
// kubectl itself can impersonate
- kubeconfigFile, err := ioutil.TempFile("", "dbg_kubeconfig")
+ kubeconfigFile, err := os.CreateTemp("", "dbg_kubeconfig")
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create kubeconfig temp file: %v\n", err)
os.Exit(1)