Remove references to io/ioutil package
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
This commit is contained in:
@ -18,7 +18,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
@ -28,7 +27,7 @@ import (
|
||||
"github.com/containernetworking/cni/pkg/invoke"
|
||||
"github.com/containernetworking/cni/pkg/skel"
|
||||
"github.com/containernetworking/cni/pkg/types"
|
||||
"github.com/containernetworking/cni/pkg/types/100"
|
||||
types100 "github.com/containernetworking/cni/pkg/types/100"
|
||||
"github.com/containernetworking/plugins/pkg/ns"
|
||||
"github.com/containernetworking/plugins/pkg/testutils"
|
||||
|
||||
@ -896,7 +895,7 @@ var _ = Describe("bandwidth test", func() {
|
||||
packetInBytes = rateInBytes * 25
|
||||
|
||||
var err error
|
||||
dataDir, err = ioutil.TempDir("", "bandwidth_linux_test")
|
||||
dataDir, err = os.MkdirTemp("", "bandwidth_linux_test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
ptpConf = fmt.Sprintf(`{
|
||||
|
@ -21,7 +21,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
@ -235,7 +234,7 @@ func createBackup(ifName, containerID, backupPath string, tuningConf *TuningConf
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshall data for %q: %v", ifName, err)
|
||||
}
|
||||
if err = ioutil.WriteFile(path.Join(backupPath, containerID+"_"+ifName+".json"), data, 0600); err != nil {
|
||||
if err = os.WriteFile(path.Join(backupPath, containerID+"_"+ifName+".json"), data, 0600); err != nil {
|
||||
return fmt.Errorf("failed to save file %s.json: %v", ifName, err)
|
||||
}
|
||||
|
||||
@ -250,7 +249,7 @@ func restoreBackup(ifName, containerID, backupPath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
file, err := ioutil.ReadFile(filePath)
|
||||
file, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open file %q: %v", filePath, err)
|
||||
}
|
||||
@ -349,7 +348,7 @@ func cmdAdd(args *skel.CmdArgs) error {
|
||||
return fmt.Errorf("invalid net sysctl key: %q", key)
|
||||
}
|
||||
content := []byte(value)
|
||||
err := ioutil.WriteFile(fileName, content, 0644)
|
||||
err := os.WriteFile(fileName, content, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -441,7 +440,7 @@ func cmdCheck(args *skel.CmdArgs) error {
|
||||
for key, confValue := range tuningConf.SysCtl {
|
||||
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
|
||||
|
||||
contents, err := ioutil.ReadFile(fileName)
|
||||
contents, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user