remove uses of ioutil

pull/13901/head
Steven Powell 2022-04-01 10:39:14 -07:00
parent ee5f619a50
commit 3325dd31cb
5 changed files with 5 additions and 10 deletions

View File

@ -19,7 +19,6 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
@ -40,7 +39,7 @@ func validateSchema(schemaPathString, docPathString string) {
log.Fatal(err)
}
data, err := ioutil.ReadFile(docPathString)
data, err := os.ReadFile(docPathString)
if err != nil {
log.Fatal(err)
}

View File

@ -26,7 +26,6 @@ import (
"crypto/sha256"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
@ -275,7 +274,7 @@ func TestBinaryMirror(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), Minutes(10))
defer Cleanup(t, profile, cancel)
tmpDir, err := ioutil.TempDir("", "kb_test")
tmpDir, err := os.MkdirTemp("", "kb_test")
if err != nil {
t.Fatal(err)
}

View File

@ -25,7 +25,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
@ -1710,7 +1709,7 @@ func validateCpCmd(ctx context.Context, t *testing.T, profile string) {
testCpCmd(ctx, t, profile, "", srcPath, "", dstPath)
// copy from node
tmpDir, err := ioutil.TempDir("", "mk_test")
tmpDir, err := os.MkdirTemp("", "mk_test")
if err != nil {
t.Fatal(err)
}

View File

@ -29,7 +29,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@ -522,7 +521,7 @@ func cpTestLocalPath() string {
func cpTestReadText(ctx context.Context, t *testing.T, profile, node, path string) string {
if node == "" {
expected, err := ioutil.ReadFile(path)
expected, err := os.ReadFile(path)
if err != nil {
t.Errorf("failed to read test file 'testdata/cp-test.txt' : %v", err)
}

View File

@ -22,7 +22,6 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"os"
"os/exec"
@ -180,7 +179,7 @@ func validateCopyFileWithMultiNode(ctx context.Context, t *testing.T, profile st
t.Errorf("failed to decode json from status: args %q: %v", rr.Command(), err)
}
tmpDir, err := ioutil.TempDir("", "mk_cp_test")
tmpDir, err := os.MkdirTemp("", "mk_cp_test")
if err != nil {
t.Fatal(err)
}