chore: remove refs to deprecated io/ioutil (#2717)

Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
This commit is contained in:
guangwu
2023-10-16 10:23:50 +08:00
committed by GitHub
parent b617c97342
commit 39d2f293c6
7 changed files with 10 additions and 15 deletions
+1 -2
View File
@@ -4,7 +4,6 @@ import (
"bytes"
"crypto/rand"
"io"
"io/ioutil"
"os"
"testing"
@@ -120,7 +119,7 @@ func TestMultiBufferReadAllToByte(t *testing.T) {
common.Must(err)
f.Close()
cnt, err := ioutil.ReadFile(dat)
cnt, err := os.ReadFile(dat)
common.Must(err)
if d := cmp.Diff(buf2, cnt); d != "" {
+2 -2
View File
@@ -3,7 +3,7 @@ package cmdarg
import (
"bytes"
"io"
"io/ioutil"
"os"
)
// LoadArg loads one arg, maybe an remote url, or local file path
@@ -18,7 +18,7 @@ func LoadArg(arg string) (out io.Reader, err error) {
// LoadArgToBytes loads one arg to []byte, maybe an remote url, or local file path
func LoadArgToBytes(arg string) (out []byte, err error) {
out, err = ioutil.ReadFile(arg)
out, err = os.ReadFile(arg)
if err != nil {
return
}
+1 -2
View File
@@ -1,7 +1,6 @@
package log_test
import (
"io/ioutil"
"os"
"strings"
"testing"
@@ -13,7 +12,7 @@ import (
)
func TestFileLogger(t *testing.T) {
f, err := ioutil.TempFile("", "vtest")
f, err := os.CreateTemp("", "vtest")
common.Must(err)
path := f.Name()
common.Must(f.Close())