1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-19 14:57:04 +00:00

Replace uses of ioutil

ioutil package was deprecated in Go 1.16, replace all uses with their
respective replacements.

This patch was generated with a combination of `gofmt -r`, `eg`, and
manually (for `ioutil.ReadDir`).
This commit is contained in:
Alberto Bertogli
2022-11-12 20:02:52 +00:00
parent 008367d320
commit 3ebe5c5173
22 changed files with 42 additions and 61 deletions

View File

@@ -8,7 +8,6 @@ import (
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"io/ioutil"
"math/big"
"net"
"os"
@@ -20,7 +19,7 @@ import (
// MustTempDir creates a temporary directory, or dies trying.
func MustTempDir(t *testing.T) string {
dir, err := ioutil.TempDir("", "testlib_")
dir, err := os.MkdirTemp("", "testlib_")
if err != nil {
t.Fatal(err)
}
@@ -55,7 +54,7 @@ func Rewrite(t *testing.T, path, contents string) error {
panic("invalid/dangerous path")
}
err := ioutil.WriteFile(path, []byte(contents), 0600)
err := os.WriteFile(path, []byte(contents), 0600)
if err != nil {
t.Errorf("failed to rewrite file: %v", err)
}