Remove deprecated io/ioutil (#15707)

This commit is contained in:
Klaus Post
2022-09-19 20:05:16 +02:00
committed by GitHub
parent 0b6175b742
commit ff12080ff5
89 changed files with 315 additions and 370 deletions

View File

@@ -22,7 +22,6 @@ package mountinfo
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@@ -40,7 +39,7 @@ func TestCrossDeviceMountPaths(t *testing.T) {
var err error
dir := t.TempDir()
mountsPath := filepath.Join(dir, "mounts")
if err = ioutil.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
if err = os.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
t.Fatal(err)
}
// Failure case where we detected successfully cross device mounts.
@@ -89,7 +88,7 @@ func TestCrossDeviceMount(t *testing.T) {
var err error
dir := t.TempDir()
mountsPath := filepath.Join(dir, "mounts")
if err = ioutil.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
if err = os.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
t.Fatal(err)
}
mounts, err := readProcMounts(mountsPath)
@@ -138,7 +137,7 @@ func TestReadProcmountInfos(t *testing.T) {
dir := t.TempDir()
mountsPath := filepath.Join(dir, "mounts")
if err = ioutil.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
if err = os.WriteFile(mountsPath, []byte(successCase), 0o666); err != nil {
t.Fatal(err)
}
// Verifies if reading each line worked properly.