diff --git a/bench_test.go b/bench_test.go index c3f849c1..9d89c210 100644 --- a/bench_test.go +++ b/bench_test.go @@ -1,7 +1,7 @@ package avro_test import ( - "io/ioutil" + "os" "testing" "github.com/hamba/avro/v2" @@ -33,7 +33,7 @@ type PartialSuperhero struct { } func BenchmarkSuperheroDecode(b *testing.B) { - data, err := ioutil.ReadFile("testdata/superhero.bin") + data, err := os.ReadFile("testdata/superhero.bin") if err != nil { panic(err) } @@ -79,7 +79,7 @@ func BenchmarkSuperheroEncode(b *testing.B) { } func BenchmarkPartialSuperheroDecode(b *testing.B) { - data, err := ioutil.ReadFile("testdata/superhero.bin") + data, err := os.ReadFile("testdata/superhero.bin") if err != nil { panic(err) } @@ -99,7 +99,7 @@ func BenchmarkPartialSuperheroDecode(b *testing.B) { } func BenchmarkSuperheroGenericDecode(b *testing.B) { - data, err := ioutil.ReadFile("testdata/superhero.bin") + data, err := os.ReadFile("testdata/superhero.bin") if err != nil { panic(err) } diff --git a/ocf/codec.go b/ocf/codec.go index a690c72d..2340a6dd 100644 --- a/ocf/codec.go +++ b/ocf/codec.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" "hash/crc32" - "io/ioutil" + "io" "github.com/golang/snappy" ) @@ -67,7 +67,7 @@ type DeflateCodec struct { // Decode decodes the given bytes. func (c *DeflateCodec) Decode(b []byte) ([]byte, error) { r := flate.NewReader(bytes.NewBuffer(b)) - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { _ = r.Close() return nil, err diff --git a/protocol.go b/protocol.go index a55230da..03a25c8c 100644 --- a/protocol.go +++ b/protocol.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "errors" "fmt" - "io/ioutil" + "os" jsoniter "github.com/json-iterator/go" "github.com/mitchellh/mapstructure" @@ -201,7 +201,7 @@ func (m *Message) String() string { // ParseProtocolFile parses an Avro protocol from a file. func ParseProtocolFile(path string) (*Protocol, error) { - s, err := ioutil.ReadFile(path) + s, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/schema_parse.go b/schema_parse.go index 3a1ba314..2d74e93b 100644 --- a/schema_parse.go +++ b/schema_parse.go @@ -3,8 +3,8 @@ package avro import ( "errors" "fmt" - "io/ioutil" "math" + "os" "path/filepath" "strings" @@ -46,7 +46,7 @@ func MustParse(schema string) Schema { func ParseFiles(paths ...string) (Schema, error) { var schema Schema for _, path := range paths { - s, err := ioutil.ReadFile(filepath.Clean(path)) + s, err := os.ReadFile(filepath.Clean(path)) if err != nil { return nil, err }