X Tutup
Skip to content

Commit b35fb7d

Browse files
committed
remove io/ioutil
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
1 parent 62a4e70 commit b35fb7d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

integration/container_update_resources_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
"bytes"
24-
"io/ioutil"
2524
"os"
2625
"strings"
2726
"testing"
@@ -116,7 +115,7 @@ func getCgroupMemoryLimitForTask(t *testing.T, task containerd.Task) uint64 {
116115
func isSwapLikelyEnabled() bool {
117116
// Check whether swap is enabled.
118117
swapFile := "/proc/swaps"
119-
swapData, err := ioutil.ReadFile(swapFile)
118+
swapData, err := os.ReadFile(swapFile)
120119
if err != nil {
121120
// We can't read the file or it doesn't exist, assume we don't have swap.
122121
return false

integration/volume_copy_up_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package integration
1818

1919
import (
2020
"fmt"
21-
"io/ioutil"
2221
"os"
2322
"path/filepath"
2423
goruntime "runtime"
@@ -76,7 +75,7 @@ func TestVolumeCopyUp(t *testing.T) {
7675
assert.Equal(t, len(volumePaths), 1, "expected exactly 1 volume")
7776

7877
testFilePath := filepath.Join(volumePaths[0], "test_file")
79-
contents, err := ioutil.ReadFile(testFilePath)
78+
contents, err := os.ReadFile(testFilePath)
8079
require.NoError(t, err)
8180
assert.Equal(t, "test_content\n", string(contents))
8281

@@ -89,7 +88,7 @@ func TestVolumeCopyUp(t *testing.T) {
8988
require.NoError(t, err)
9089

9190
t.Logf("Check whether host path of the volume is updated")
92-
contents, err = ioutil.ReadFile(testFilePath)
91+
contents, err = os.ReadFile(testFilePath)
9392
require.NoError(t, err)
9493
assert.Equal(t, "new_content\n", string(contents))
9594
}
@@ -159,7 +158,7 @@ func getHostPathForVolumes(criRoot, containerID string) ([]string, error) {
159158
return nil, err
160159
}
161160

162-
volumes, err := ioutil.ReadDir(hostPath)
161+
volumes, err := os.ReadDir(hostPath)
163162
if err != nil {
164163
return nil, err
165164
}

runtime/v2/runc/manager/manager_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"encoding/json"
2222
"fmt"
23-
"io/ioutil"
23+
"io"
2424
"os"
2525
"path/filepath"
2626
goruntime "runtime"
@@ -196,7 +196,7 @@ func (manager) Start(ctx context.Context, id string, opts shim.StartOpts) (_ str
196196
}()
197197
// make sure to wait after start
198198
go cmd.Wait()
199-
if data, err := ioutil.ReadAll(os.Stdin); err == nil {
199+
if data, err := io.ReadAll(os.Stdin); err == nil {
200200
if len(data) > 0 {
201201
var any ptypes.Any
202202
if err := proto.Unmarshal(data, &any); err != nil {

0 commit comments

Comments
 (0)
X Tutup