Skip to content

Commit

Permalink
Drop references to deprecated ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Jan 17, 2024
1 parent 39be251 commit 8bc7aaf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions historyarchive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/url"
"path"
"regexp"
Expand Down Expand Up @@ -149,8 +148,8 @@ func (a *Archive) PutPathHAS(path string, has HistoryArchiveState, opts *Command
if err != nil {
return err
}
return a.backend.PutFile(path,
ioutil.NopCloser(bytes.NewReader(buf)))

return a.backend.PutFile(path, io.NopCloser(bytes.NewReader(buf)))
}

func (a *Archive) BucketExists(bucket Hash) (bool, error) {
Expand Down
7 changes: 3 additions & 4 deletions historyarchive/xdrstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"fmt"
"hash"
"io"
"io/ioutil"

"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
Expand Down Expand Up @@ -107,7 +106,7 @@ func (x *XdrStream) ExpectedHash() ([sha256.Size]byte, bool) {
func (x *XdrStream) Close() error {
if x.validateHash {
// Read all remaining data from rdr
_, err := io.Copy(ioutil.Discard, x.rdr)
_, err := io.Copy(io.Discard, x.rdr)
if err != nil {
// close the internal readers to avoid memory leaks
x.closeReaders()
Expand Down Expand Up @@ -204,7 +203,7 @@ func (x *XdrStream) GzipBytesRead() int64 {

// Discard removes n bytes from the stream
func (x *XdrStream) Discard(n int64) (int64, error) {
return io.CopyN(ioutil.Discard, x.rdr, n)
return io.CopyN(io.Discard, x.rdr, n)
}

func CreateXdrStream(entries ...xdr.BucketEntry) *XdrStream {
Expand All @@ -216,5 +215,5 @@ func CreateXdrStream(entries ...xdr.BucketEntry) *XdrStream {
}
}

return NewXdrStream(ioutil.NopCloser(b))
return NewXdrStream(io.NopCloser(b))
}

0 comments on commit 8bc7aaf

Please sign in to comment.