io/ioutil deprecated (#3217)

This commit is contained in:
guangwu
2023-05-06 17:50:54 +08:00
committed by GitHub
parent 4f13fe8188
commit 63368d8b0c
27 changed files with 85 additions and 89 deletions

View File

@@ -1,7 +1,6 @@
package pathx
import (
"io/ioutil"
"os"
"path/filepath"
"testing"
@@ -23,7 +22,7 @@ func TestGetTemplateDir(t *testing.T) {
return
}
tempFile := filepath.Join(dir, "bar.txt")
err = ioutil.WriteFile(tempFile, []byte("foo"), os.ModePerm)
err = os.WriteFile(tempFile, []byte("foo"), os.ModePerm)
if err != nil {
return
}
@@ -79,7 +78,7 @@ func TestGetGoctlHome(t *testing.T) {
t.Run("goctl_is_file", func(t *testing.T) {
tmpFile := filepath.Join(t.TempDir(), "a.tmp")
backupTempFile := tmpFile + ".old"
err := ioutil.WriteFile(tmpFile, nil, 0o666)
err := os.WriteFile(tmpFile, nil, 0o666)
if err != nil {
return
}