cephfs: remove refs to deprecated io/ioutil

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guoguangwu 2023-07-08 13:47:44 +08:00 committed by mergify[bot]
parent a8be907f02
commit 448e4b7f5c
2 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,7 @@ package admin
import ( import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"os" "os"
pathpkg "path" pathpkg "path"
"testing" "testing"
@ -57,7 +57,7 @@ func readFile(t *testing.T, mount *cephfs.MountInfo, path string) []byte {
f1, err := mount.Open(path, os.O_RDONLY, 0) f1, err := mount.Open(path, os.O_RDONLY, 0)
require.NoError(t, err) require.NoError(t, err)
defer f1.Close() defer f1.Close()
b, err := ioutil.ReadAll(f1) b, err := io.ReadAll(f1)
require.NoError(t, err) require.NoError(t, err)
return b return b
} }

View File

@ -3,7 +3,6 @@ package cephfs
import ( import (
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"testing" "testing"
"time" "time"
@ -336,7 +335,7 @@ func TestValidate(t *testing.T) {
} }
func TestReadConfigFile(t *testing.T) { func TestReadConfigFile(t *testing.T) {
file, err := ioutil.TempFile("/tmp", "cephfs.conf") file, err := os.CreateTemp("/tmp", "cephfs.conf")
require.NoError(t, err) require.NoError(t, err)
defer func() { defer func() {
assert.NoError(t, file.Close()) assert.NoError(t, file.Close())