Skip to content

Commit 10d9d1a

Browse files
authored
Merge pull request #6118 from zouyee/ioutil
cleanup deprecated package `io/ioutil `
2 parents 0855725 + 1f1cad3 commit 10d9d1a

4 files changed

Lines changed: 5 additions & 9 deletions

File tree

contrib/fuzz/metadata_fuzzer.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package fuzz
1919
import (
2020
"context"
2121
"fmt"
22-
"io/ioutil"
2322
"os"
2423
"path/filepath"
2524

@@ -43,7 +42,7 @@ func testEnv() (context.Context, *bolt.DB, func(), error) {
4342
ctx, cancel := context.WithCancel(context.Background())
4443
ctx = namespaces.WithNamespace(ctx, "testing")
4544

46-
dirname, err := ioutil.TempDir("", "fuzz-")
45+
dirname, err := os.MkdirTemp("", "fuzz-")
4746
if err != nil {
4847
return ctx, nil, nil, err
4948
}
@@ -263,7 +262,7 @@ func testDB(opt ...testOpt) (context.Context, *metadata.DB, func(), error) {
263262
o(&topts)
264263
}
265264

266-
dirname, err := ioutil.TempDir("", "fuzzing-")
265+
dirname, err := os.MkdirTemp("", "fuzzing-")
267266
if err != nil {
268267
return ctx, nil, func() { cancel() }, err
269268
}

integration/shim_dial_unix_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package integration
2121

2222
import (
2323
"context"
24-
"io/ioutil"
2524
"net"
2625
"os"
2726
"path/filepath"
@@ -147,7 +146,7 @@ func testFailFastWhenConnectShim(abstract bool, dialFn dialFunc) func(*testing.T
147146
}
148147

149148
func newTestListener(t testing.TB, abstract bool) (string, net.Listener, func()) {
150-
tmpDir, err := ioutil.TempDir("", "shim-ut-XX")
149+
tmpDir, err := os.MkdirTemp("", "shim-ut-XX")
151150
if err != nil {
152151
t.Fatalf("failed to create tmp directory: %v", err)
153152
}

runtime/v1/linux/bundle_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ package linux
2222
import (
2323
"encoding/json"
2424
"fmt"
25-
"io/ioutil"
2625
"os"
2726
"path/filepath"
2827
"strconv"
@@ -49,7 +48,7 @@ func TestNewBundle(t *testing.T) {
4948

5049
for i, tc := range tests {
5150
t.Run(strconv.Itoa(i), func(t *testing.T) {
52-
dir, err := ioutil.TempDir("", "test-new-bundle")
51+
dir, err := os.MkdirTemp("", "test-new-bundle")
5352
require.NoError(t, err, "failed to create test directory")
5453
defer os.RemoveAll(dir)
5554
work := filepath.Join(dir, "work")

runtime/v2/bundle_linux_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121
"encoding/json"
2222
"fmt"
23-
"io/ioutil"
2423
"os"
2524
"path/filepath"
2625
"strconv"
@@ -48,7 +47,7 @@ func TestNewBundle(t *testing.T) {
4847

4948
for i, tc := range tests {
5049
t.Run(strconv.Itoa(i), func(t *testing.T) {
51-
dir, err := ioutil.TempDir("", "test-new-bundle")
50+
dir, err := os.MkdirTemp("", "test-new-bundle")
5251
require.NoError(t, err, "failed to create test directory")
5352
defer os.RemoveAll(dir)
5453
work := filepath.Join(dir, "work")

0 commit comments

Comments
 (0)