diff --git a/compile/compile_test.go b/compile/compile_test.go index aee3caac..fe2c8671 100644 --- a/compile/compile_test.go +++ b/compile/compile_test.go @@ -10,7 +10,7 @@ package compile import ( "fmt" - "io/ioutil" + "io" "os/exec" "testing" @@ -118,7 +118,7 @@ func EqCodeCode(t *testing.T, name string, a, b string) { t.Errorf("%s code want %q, got %q", name, a, b) return } - stdoutData, err := ioutil.ReadAll(stdout) + stdoutData, err := io.ReadAll(stdout) if err != nil { t.Fatalf("Failed to read data: %v", err) } diff --git a/modules/runtime.go b/modules/runtime.go index 91fc7092..0b003022 100644 --- a/modules/runtime.go +++ b/modules/runtime.go @@ -6,7 +6,6 @@ package modules import ( "bytes" - "io/ioutil" "os" "path" "path/filepath" @@ -145,7 +144,7 @@ func (ctx *context) ResolveAndCompile(pathname string, opts py.CompileOpts) (py. switch ext { case ".py": var pySrc []byte - pySrc, err = ioutil.ReadFile(fpath) + pySrc, err = os.ReadFile(fpath) if err != nil { return false, py.ExceptionNewf(py.OSError, "Error reading %q: %v", fpath, err) } diff --git a/parser/testparser/testparser.go b/parser/testparser/testparser.go index 6bf2d8e7..410ca043 100644 --- a/parser/testparser/testparser.go +++ b/parser/testparser/testparser.go @@ -7,7 +7,7 @@ package main import ( "flag" "fmt" - "io/ioutil" + "io" "log" "os" @@ -47,7 +47,7 @@ func main() { _, err = parser.Lex(in, path, "exec") } else if *compileFile { var input []byte - input, err = ioutil.ReadAll(in) + input, err = io.ReadAll(in) if err != nil { log.Fatalf("Failed to read %q: %v", path, err) } diff --git a/py/file.go b/py/file.go index fa270865..c60013ad 100644 --- a/py/file.go +++ b/py/file.go @@ -11,7 +11,6 @@ package py import ( "io" - "io/ioutil" "os" ) @@ -129,7 +128,7 @@ func (o *File) Read(args Tuple, kwargs StringDict) (Object, error) { return nil, ExceptionNewf(TypeError, "read() argument 1 must be int, not %s", arg.Type().Name) } - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { if err == io.EOF { return o.readResult(nil) diff --git a/pytest/pytest.go b/pytest/pytest.go index c7af7737..db556f6e 100644 --- a/pytest/pytest.go +++ b/pytest/pytest.go @@ -5,7 +5,7 @@ package pytest import ( - "io/ioutil" + "io" "os" "path" "strings" @@ -31,7 +31,7 @@ func compileProgram(t testing.TB, prog string) (*py.Module, *py.Code) { } }() - str, err := ioutil.ReadAll(f) + str, err := io.ReadAll(f) if err != nil { t.Fatalf("%s: ReadAll failed: %v", prog, err) } @@ -92,7 +92,7 @@ func run(t testing.TB, module *py.Module, code *py.Code) { // find the python files in the directory passed in func findFiles(t testing.TB, testDir string) (names []string) { - files, err := ioutil.ReadDir(testDir) + files, err := os.ReadDir(testDir) if err != nil { t.Fatalf("ReadDir failed: %v", err) }