mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 00:47:56 +01:00
Remove calls to Go's deprecated "io/ioutil"
This commit is contained in:
1 parent
788479dd64
commit
226c476994
31 files changed
+73
-93
No files matched your search
@@ -25,7 +25,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
@@ -68,7 +67,7 @@ func main1() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ioutil.WriteFile("data.go", formatted, 0644)
|
||||
return os.WriteFile("data.go", formatted, 0644)
|
||||
}
|
||||
|
||||
func genData(out *bytes.Buffer) error {
|
||||
@@ -114,7 +113,7 @@ func genData(out *bytes.Buffer) error {
|
||||
copyright := []byte(nil)
|
||||
|
||||
for _, f := range files {
|
||||
in, err := ioutil.ReadFile(f.filename)
|
||||
in, err := os.ReadFile(f.filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package testcut
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func calculateDecodedLen(b []byte,
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
n, err := io.Copy(ioutil.Discard, r)
|
||||
n, err := io.Copy(io.Discard, r)
|
||||
if err != nil {
|
||||
r.Close()
|
||||
return 0, err
|
||||
@@ -48,7 +48,7 @@ func Test(tt *testing.T,
|
||||
filenames []string) {
|
||||
|
||||
for _, filename := range filenames {
|
||||
full, err := ioutil.ReadFile("../../test/data/" + filename)
|
||||
full, err := os.ReadFile("../../test/data/" + filename)
|
||||
if err != nil {
|
||||
tt.Errorf("f=%q: ReadFile: %v", filename, err)
|
||||
continue
|
||||
@@ -151,7 +151,7 @@ func Benchmark(b *testing.B,
|
||||
trimSuffix int,
|
||||
decodedLen int64) {
|
||||
|
||||
full, err := ioutil.ReadFile("../../test/data/" + filename)
|
||||
full, err := os.ReadFile("../../test/data/" + filename)
|
||||
if err != nil {
|
||||
b.Fatalf("ReadFile: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user