Replace ioutil with io and os (#10541)

* Replace ioutil with io and os

* Fix build errors
This commit is contained in:
Håvard Anda Estensen
2022-04-18 22:42:07 +02:00
committed by GitHub
parent 982de94428
commit d2f4a8cc7c
102 changed files with 256 additions and 291 deletions

View File

@@ -3,7 +3,6 @@ package testdata
import (
"crypto/rand"
"fmt"
ioAlias "io/ioutil"
"math/big"
osAlias "os"
"path/filepath"
@@ -15,5 +14,5 @@ func UseAliasedPackages() {
p := filepath.Join(tempDir(), fmt.Sprintf("/%d", randPath))
_ = osAlias.MkdirAll(p, osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
someFile := filepath.Join(p, "some.txt")
_ = ioAlias.WriteFile(someFile, []byte("hello"), osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
_ = osAlias.WriteFile(someFile, []byte("hello"), osAlias.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
}

View File

@@ -3,7 +3,6 @@ package testdata
import (
"crypto/rand"
"fmt"
"io/ioutil"
"math/big"
"os"
"path/filepath"
@@ -23,5 +22,5 @@ func UseOsMkdirAllAndWriteFile() {
p := filepath.Join(tempDir(), fmt.Sprintf("/%d", randPath))
_ = os.MkdirAll(p, os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
someFile := filepath.Join(p, "some.txt")
_ = ioutil.WriteFile(someFile, []byte("hello"), os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
_ = os.WriteFile(someFile, []byte("hello"), os.ModePerm) // want "os and ioutil dir and file writing functions are not permissions-safe, use shared/file"
}