Remove io/ioutil use

See https://golang.org/doc/go1.16#ioutil

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-10-13 13:24:01 -07:00
parent 6a4f4a6a37
commit 5516294172
28 changed files with 109 additions and 77 deletions

View File

@@ -3,7 +3,6 @@ package libcontainer
import (
"encoding/binary"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -18,10 +17,10 @@ func testMemoryNotification(t *testing.T, evName string, notify notifyFunc, targ
memoryPath := t.TempDir()
evFile := filepath.Join(memoryPath, evName)
eventPath := filepath.Join(memoryPath, "cgroup.event_control")
if err := ioutil.WriteFile(evFile, []byte{}, 0o700); err != nil {
if err := os.WriteFile(evFile, []byte{}, 0o700); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(eventPath, []byte{}, 0o700); err != nil {
if err := os.WriteFile(eventPath, []byte{}, 0o700); err != nil {
t.Fatal(err)
}
ch, err := notify(memoryPath)
@@ -29,7 +28,7 @@ func testMemoryNotification(t *testing.T, evName string, notify notifyFunc, targ
t.Fatal("expected no error, got:", err)
}
data, err := ioutil.ReadFile(eventPath)
data, err := os.ReadFile(eventPath)
if err != nil {
t.Fatal("couldn't read event control file:", err)
}