refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"runtime"
|
||||
@@ -104,7 +103,7 @@ func makeTest(t *testing.T, name string, storeFn func(ctx context.Context, root
|
||||
ctx := context.WithValue(context.Background(), nameKey{}, name)
|
||||
ctx = logtest.WithT(ctx, t)
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "content-suite-"+name+"-")
|
||||
tmpDir, err := os.MkdirTemp("", "content-suite-"+name+"-")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -782,7 +781,7 @@ func checkSmallBlob(ctx context.Context, t *testing.T, store content.Store) {
|
||||
}
|
||||
defer ra.Close()
|
||||
r := io.NewSectionReader(ra, 0, readSize)
|
||||
b, err := ioutil.ReadAll(r)
|
||||
b, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -1080,7 +1079,7 @@ func createContent(size int64) ([]byte, digest.Digest) {
|
||||
// test runs. An atomic integer works just good enough for this.
|
||||
seed := atomic.AddInt64(&contentSeed, 1)
|
||||
|
||||
b, err := ioutil.ReadAll(io.LimitReader(rand.New(rand.NewSource(seed)), size))
|
||||
b, err := io.ReadAll(io.LimitReader(rand.New(rand.NewSource(seed)), size))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user