Merge pull request #6426 from ningmingxiao/dev6

remove io/ioutil
This commit is contained in:
Derek McGowan 2022-01-11 13:42:45 -08:00 committed by GitHub
commit bce18cb04f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -21,7 +21,6 @@ package integration
import (
"bytes"
"io/ioutil"
"os"
"strings"
"testing"
@ -116,7 +115,7 @@ func getCgroupMemoryLimitForTask(t *testing.T, task containerd.Task) uint64 {
func isSwapLikelyEnabled() bool {
// Check whether swap is enabled.
swapFile := "/proc/swaps"
swapData, err := ioutil.ReadFile(swapFile)
swapData, err := os.ReadFile(swapFile)
if err != nil {
// We can't read the file or it doesn't exist, assume we don't have swap.
return false

View File

@ -18,7 +18,6 @@ package integration
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
goruntime "runtime"
@ -76,7 +75,7 @@ func TestVolumeCopyUp(t *testing.T) {
assert.Equal(t, len(volumePaths), 1, "expected exactly 1 volume")
testFilePath := filepath.Join(volumePaths[0], "test_file")
contents, err := ioutil.ReadFile(testFilePath)
contents, err := os.ReadFile(testFilePath)
require.NoError(t, err)
assert.Equal(t, "test_content\n", string(contents))
@ -89,7 +88,7 @@ func TestVolumeCopyUp(t *testing.T) {
require.NoError(t, err)
t.Logf("Check whether host path of the volume is updated")
contents, err = ioutil.ReadFile(testFilePath)
contents, err = os.ReadFile(testFilePath)
require.NoError(t, err)
assert.Equal(t, "new_content\n", string(contents))
}
@ -159,7 +158,7 @@ func getHostPathForVolumes(criRoot, containerID string) ([]string, error) {
return nil, err
}
volumes, err := ioutil.ReadDir(hostPath)
volumes, err := os.ReadDir(hostPath)
if err != nil {
return nil, err
}

View File

@ -20,7 +20,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
goruntime "runtime"
@ -196,7 +196,7 @@ func (manager) Start(ctx context.Context, id string, opts shim.StartOpts) (_ str
}()
// make sure to wait after start
go cmd.Wait()
if data, err := ioutil.ReadAll(os.Stdin); err == nil {
if data, err := io.ReadAll(os.Stdin); err == nil {
if len(data) > 0 {
var any ptypes.Any
if err := proto.Unmarshal(data, &any); err != nil {