io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os

This commit is contained in:
ahrtr
2021-10-30 06:41:02 +08:00
parent 2d0fa78f2f
commit fe95aa614c
96 changed files with 250 additions and 297 deletions

View File

@@ -18,7 +18,7 @@ package e2enode
import (
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@@ -434,7 +434,7 @@ func recordSystemCgroupProcesses() {
if IsCgroup2UnifiedMode() {
filePattern = "/sys/fs/cgroup/%s/cgroup.procs"
}
pids, err := ioutil.ReadFile(fmt.Sprintf(filePattern, cgroup))
pids, err := os.ReadFile(fmt.Sprintf(filePattern, cgroup))
if err != nil {
framework.Logf("Failed to read processes in cgroup %s: %v", name, err)
continue
@@ -443,7 +443,7 @@ func recordSystemCgroupProcesses() {
framework.Logf("Processes in %s cgroup (%s):", name, cgroup)
for _, pid := range strings.Fields(string(pids)) {
path := fmt.Sprintf("/proc/%s/cmdline", pid)
cmd, err := ioutil.ReadFile(path)
cmd, err := os.ReadFile(path)
if err != nil {
framework.Logf(" ginkgo.Failed to read %s: %v", path, err)
} else {