Skip to content

Commit

Permalink
chore: remove depreciated ioutil package (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored Jun 21, 2022
1 parent e926a50 commit a0d9b2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions bench_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package avro_test

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

"github.com/hamba/avro/v2"
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions ocf/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"errors"
"fmt"
"hash/crc32"
"io/ioutil"
"io"

"github.com/golang/snappy"
)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"io/ioutil"
"os"

jsoniter "github.com/json-iterator/go"
"github.com/mitchellh/mapstructure"
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions schema_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package avro
import (
"errors"
"fmt"
"io/ioutil"
"math"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit a0d9b2e

Please sign in to comment.