FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

all: remove use of deprecated io/ioutil package by sbinet · Pull Request #173 · go-python/gpython · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .go  (5) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions compile/compile_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package compile

import (
"fmt"
"io/ioutil"
"io"
"os/exec"
"testing"

Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions modules/runtime.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package modules

import (
"bytes"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions parser/testparser/testparser.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"io"
"log"
"os"

Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 1 addition & 2 deletions py/file.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package py

import (
"io"
"io/ioutil"
"os"
)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pytest/pytest.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package pytest

import (
"io/ioutil"
"io"
"os"
"path"
"strings"
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

Back | FazBrowse Home | New Git URL