Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expunge io/ioutil #486

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions capnpc-go/capnpc-go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"go/parser"
"go/token"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strconv"
Expand All @@ -19,7 +19,7 @@ import (

func readTestFile(name string) ([]byte, error) {
path := filepath.Join("testdata", name)
return ioutil.ReadFile(path)
return os.ReadFile(path)
}

func mustReadTestFile(t *testing.T, name string) []byte {
Expand Down
4 changes: 2 additions & 2 deletions encoding/text/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package text

import (
"bytes"
"io/ioutil"
"os"
"path/filepath"
"testing"

Expand All @@ -13,7 +13,7 @@ import (

func readTestFile(name string) ([]byte, error) {
path := filepath.Join("testdata", name)
return ioutil.ReadFile(path)
return os.ReadFile(path)
}

func TestEncode(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package capnp_test

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

"capnproto.org/go/capnp/v3"
Expand Down Expand Up @@ -75,7 +74,7 @@ func Example() {
_ = buf

// ... or write to an io.Writer.
file, err := ioutil.TempFile("", "go-capnproto")
file, err := os.CreateTemp("", "go-capnproto")
if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions packed/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"bufio"
"bytes"
"io"
"io/ioutil"
)

func Fuzz(data []byte) int {
Expand All @@ -26,7 +25,7 @@ func Fuzz(data []byte) int {
// Read
{
r := NewReader(bufio.NewReader(bytes.NewReader(data)))
if unpacked, err := ioutil.ReadAll(r); err == nil {
if unpacked, err := io.ReadAll(r); err == nil {
checkRepack(unpacked)
result = 1
}
Expand Down
5 changes: 2 additions & 3 deletions packed/packed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"math"
"strings"
"testing"
Expand Down Expand Up @@ -381,7 +380,7 @@ func TestReader_Fail(t *testing.T) {
for _, test := range badDecompressionTests {
t.Run(test.name, func(t *testing.T) {
d := NewReader(bufio.NewReader(bytes.NewReader(test.input)))
_, err := ioutil.ReadAll(d)
_, err := io.ReadAll(d)
assert.Error(t, err, "should return error")
})
}
Expand Down Expand Up @@ -521,7 +520,7 @@ func mustGunzip(s string) []byte {
if err != nil {
panic(err)
}
data, err := ioutil.ReadAll(r)
data, err := io.ReadAll(r)
if err != nil {
panic(err)
}
Expand Down
3 changes: 1 addition & 2 deletions schemas/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"compress/zlib"
"errors"
"io"
"io/ioutil"
"strings"
"sync"

Expand Down Expand Up @@ -111,7 +110,7 @@ func (r *record) read() ([]byte, error) {
return
}
p := packed.NewReader(bufio.NewReader(z))
r.data, r.err = ioutil.ReadAll(p)
r.data, r.err = io.ReadAll(p)
if err != nil {
r.data = nil
return
Expand Down