From 4359978ef22a22ddd5a19adf18cbc80cb44244fb Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Thu, 23 Feb 2023 14:28:18 +0100 Subject: all: ioutil is deprecated in go1.19 (#3718) --- pkg/ast/parser.go | 4 ++-- pkg/ast/parser_test.go | 6 +++--- pkg/ast/test_util.go | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'pkg/ast') diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go index b2709e2ed..bb08a0b7e 100644 --- a/pkg/ast/parser.go +++ b/pkg/ast/parser.go @@ -6,7 +6,7 @@ package ast import ( "errors" "fmt" - "io/ioutil" + "os" "path/filepath" "strconv" "strings" @@ -62,7 +62,7 @@ func ParseGlob(glob string, errorHandler ErrorHandler) *Description { } desc := &Description{} for _, f := range files { - data, err := ioutil.ReadFile(f) + data, err := os.ReadFile(f) if err != nil { errorHandler(Pos{}, fmt.Sprintf("failed to read input file: %v", err)) return nil diff --git a/pkg/ast/parser_test.go b/pkg/ast/parser_test.go index d3a9049bc..cecdcc9b2 100644 --- a/pkg/ast/parser_test.go +++ b/pkg/ast/parser_test.go @@ -5,7 +5,7 @@ package ast import ( "bytes" - "io/ioutil" + "os" "path/filepath" "reflect" "strings" @@ -21,7 +21,7 @@ func TestParseAll(t *testing.T) { } files = append(files, filepath.FromSlash("testdata/all.txt")) for _, file := range files { - data, err := ioutil.ReadFile(file) + data, err := os.ReadFile(file) if err != nil { t.Fatalf("failed to read file: %v", err) } @@ -124,7 +124,7 @@ var parseTests = []struct { } func TestErrors(t *testing.T) { - files, err := ioutil.ReadDir("testdata") + files, err := os.ReadDir("testdata") if err != nil { t.Fatal(err) } diff --git a/pkg/ast/test_util.go b/pkg/ast/test_util.go index 697b34505..921232c96 100644 --- a/pkg/ast/test_util.go +++ b/pkg/ast/test_util.go @@ -7,7 +7,7 @@ import ( "bufio" "bytes" "fmt" - "io/ioutil" + "os" "path/filepath" "regexp" "sort" @@ -29,7 +29,7 @@ type errorDesc struct { } func NewErrorMatcher(t *testing.T, file string) *ErrorMatcher { - data, err := ioutil.ReadFile(file) + data, err := os.ReadFile(file) if err != nil { t.Fatalf("failed to open input file: %v", err) } -- cgit mrf-deployment