From 6146ad1c6c4ba23c6eaebecf306a1877ab3f1a73 Mon Sep 17 00:00:00 2001 From: zachary-walters Date: Mon, 2 Oct 2023 22:35:45 -0500 Subject: [PATCH] Replaced deprecated io/ioutil package with proper implementations of io/os packages. As of Go v1.16, the io/ioutil package has been deprecated and replaced with io and os implementations. https://go.dev/doc/go1.16#ioutil --- _codegen/main.go | 5 ++--- suite/suite_test.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/_codegen/main.go b/_codegen/main.go index 11cdbfbc6..d86a2f819 100644 --- a/_codegen/main.go +++ b/_codegen/main.go @@ -16,7 +16,6 @@ import ( "go/token" "go/types" "io" - "io/ioutil" "log" "os" "path" @@ -101,7 +100,7 @@ func parseTemplates() (*template.Template, *template.Template, error) { return nil, nil, err } if *tmplFile != "" { - f, err := ioutil.ReadFile(*tmplFile) + f, err := os.ReadFile(*tmplFile) if err != nil { return nil, nil, err } @@ -181,7 +180,7 @@ func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) { files := make(map[string]*ast.File) fileList := make([]*ast.File, len(pd.GoFiles)) for i, fname := range pd.GoFiles { - src, err := ioutil.ReadFile(path.Join(pd.Dir, fname)) + src, err := os.ReadFile(path.Join(pd.Dir, fname)) if err != nil { return nil, nil, err } diff --git a/suite/suite_test.go b/suite/suite_test.go index d684f52b9..f3094ee62 100644 --- a/suite/suite_test.go +++ b/suite/suite_test.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" "flag" - "io/ioutil" + "io" "math/rand" "os" "os/exec" @@ -429,7 +429,7 @@ func (sc *StdoutCapture) StopCapture() (string, error) { } os.Stdout.Close() os.Stdout = sc.oldStdout - bytes, err := ioutil.ReadAll(sc.readPipe) + bytes, err := io.ReadAll(sc.readPipe) if err != nil { return "", err }