Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
fix: stop using the deprecated io/ioutil package
Browse files Browse the repository at this point in the history
  • Loading branch information
web3-bot committed Aug 14, 2023
1 parent 4acf3fc commit 55ef175
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions internal/stores/filestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package stores
import (
"context"
"io"
"io/ioutil"
"math/rand"
"os"
"path/filepath"
Expand Down Expand Up @@ -112,7 +111,7 @@ func dagToNormalFile(t *testing.T, ctx context.Context, root cid.Cid, bs bstore.
return nil, err
}

finalBytes, err := ioutil.ReadAll(outputF)
finalBytes, err := io.ReadAll(outputF)
if err != nil {
return nil, err
}
Expand All @@ -136,7 +135,7 @@ func createFile(t *testing.T, rseed int64, size int64) (path string, contents []

_, err = file.Seek(0, io.SeekStart)
require.NoError(t, err)
bz, err := ioutil.ReadAll(file)
bz, err := io.ReadAll(file)
require.NoError(t, err)
require.NoError(t, file.Close())

Expand Down
5 changes: 2 additions & 3 deletions internal/stores/kvcarbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"sync"

Expand Down Expand Up @@ -331,10 +330,10 @@ func (drsb *discardingReadSeekerPlusByte) Seek(offset int64, whence int) (int64,
if n < 0 {
panic("unsupported rewind via whence: io.SeekStart")
}
_, err := io.CopyN(ioutil.Discard, drsb, n)
_, err := io.CopyN(io.Discard, drsb, n)
return drsb.offset, err
case io.SeekCurrent:
_, err := io.CopyN(ioutil.Discard, drsb, offset)
_, err := io.CopyN(io.Discard, drsb, offset)
return drsb.offset, err
default:
panic("unsupported whence: io.SeekEnd")
Expand Down
4 changes: 2 additions & 2 deletions pkg/unixfsstore/sql/dirlinks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sql_test
import (
"context"
"database/sql"
"io/ioutil"
"os"
"testing"

"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestDirLinksDB(t *testing.T) {
}

func CreateTestTmpDB(t *testing.T) *sql.DB {
f, err := ioutil.TempFile(t.TempDir(), "*.db")
f, err := os.CreateTemp(t.TempDir(), "*.db")
require.NoError(t, err)
require.NoError(t, f.Close())
d, err := ufssql.SqlDB(f.Name())
Expand Down

0 comments on commit 55ef175

Please sign in to comment.