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/node/core/debug_service.go b/metropolis/node/core/debug_service.go
index 814da9a..48a4c9b 100644
--- a/metropolis/node/core/debug_service.go
+++ b/metropolis/node/core/debug_service.go
@@ -20,7 +20,6 @@
"bufio"
"context"
"fmt"
- "io/ioutil"
"os"
"regexp"
"strings"
@@ -215,7 +214,7 @@
if !safeTracingPropertyNamesRe.MatchString(name) {
return fmt.Errorf("disallowed tracing property name received: \"%v\"", name)
}
- return ioutil.WriteFile("/sys/kernel/tracing/"+name, []byte(value+"\n"), 0)
+ return os.WriteFile("/sys/kernel/tracing/"+name, []byte(value+"\n"), 0)
}
func (s *debugService) Trace(req *apb.TraceRequest, srv apb.NodeDebugService_TraceServer) error {