aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/report
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-02-23 14:28:18 +0100
committerGitHub <noreply@github.com>2023-02-23 14:28:18 +0100
commit4359978ef22a22ddd5a19adf18cbc80cb44244fb (patch)
tree7952da94e27417b39ddf952d9e0bab431dafc4c5 /pkg/report
parent9e2ebb3c174f1e168bc1fbadd5f02f2e25e314fc (diff)
all: ioutil is deprecated in go1.19 (#3718)
Diffstat (limited to 'pkg/report')
-rw-r--r--pkg/report/linux_test.go10
-rw-r--r--pkg/report/report_test.go10
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg/report/linux_test.go b/pkg/report/linux_test.go
index 5aba2f19e..5f27b9e7d 100644
--- a/pkg/report/linux_test.go
+++ b/pkg/report/linux_test.go
@@ -6,7 +6,7 @@ package report
import (
"bytes"
"fmt"
- "io/ioutil"
+ "os"
"path/filepath"
"reflect"
"runtime"
@@ -385,7 +385,7 @@ func TestDisassemblyInReports(t *testing.T) {
}
archPath := filepath.Join("testdata", "linux", "decompile")
- subFolders, err := ioutil.ReadDir(archPath)
+ subFolders, err := os.ReadDir(archPath)
if err != nil {
t.Fatalf("disassembly reports failed: %v", err)
}
@@ -400,7 +400,7 @@ func TestDisassemblyInReports(t *testing.T) {
}
testPath := filepath.Join(archPath, obj.Name())
- testFiles, err := ioutil.ReadDir(testPath)
+ testFiles, err := os.ReadDir(testPath)
if err != nil {
t.Fatalf("failed to list tests for %v: %v", obj.Name(), err)
}
@@ -420,7 +420,7 @@ func TestDisassemblyInReports(t *testing.T) {
func testDisassembly(t *testing.T, reporter *Reporter, linuxReporter *linux, testFilePrefix string) {
t.Parallel()
- input, err := ioutil.ReadFile(testFilePrefix + ".in")
+ input, err := os.ReadFile(testFilePrefix + ".in")
if err != nil {
t.Fatalf("failed to read input file: %v", err)
}
@@ -435,7 +435,7 @@ func testDisassembly(t *testing.T, reporter *Reporter, linuxReporter *linux, tes
osutil.WriteFile(testFilePrefix+".out", result)
}
- output, err := ioutil.ReadFile(testFilePrefix + ".out")
+ output, err := os.ReadFile(testFilePrefix + ".out")
if err != nil {
t.Fatalf("failed to read output file: %v", err)
}
diff --git a/pkg/report/report_test.go b/pkg/report/report_test.go
index cea8588b3..9503ce918 100644
--- a/pkg/report/report_test.go
+++ b/pkg/report/report_test.go
@@ -8,7 +8,7 @@ import (
"bytes"
"flag"
"fmt"
- "io/ioutil"
+ "os"
"path/filepath"
"reflect"
"regexp"
@@ -44,7 +44,7 @@ type ParseTest struct {
}
func testParseFile(t *testing.T, reporter *Reporter, fn string) {
- data, err := ioutil.ReadFile(fn)
+ data, err := os.ReadFile(fn)
if err != nil {
t.Fatal(err)
}
@@ -269,7 +269,7 @@ func updateReportTest(t *testing.T, test *ParseTest, title string, altTitles []s
if test.HasReport {
fmt.Fprintf(buf, "REPORT:\n%s", test.Report)
}
- if err := ioutil.WriteFile(test.FileName, buf.Bytes(), 0640); err != nil {
+ if err := os.WriteFile(test.FileName, buf.Bytes(), 0640); err != nil {
t.Logf("failed to update test file: %v", err)
}
}
@@ -317,7 +317,7 @@ func testRawGuiltyFile(t *testing.T, reporter *Reporter, fn string) {
}
func parseGuiltyTest(t *testing.T, fn string) (map[string]string, []byte) {
- data, err := ioutil.ReadFile(fn)
+ data, err := os.ReadFile(fn)
if err != nil {
t.Fatal(err)
}
@@ -378,7 +378,7 @@ func readDir(t *testing.T, dir string) (files []string) {
if !osutil.IsExist(dir) {
return nil
}
- entries, err := ioutil.ReadDir(dir)
+ entries, err := os.ReadDir(dir)
if err != nil {
t.Fatal(err)
}