internal/e2e: deprecate io/ioutil (#341)

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
Lars Lehtonen 2023-09-08 01:03:43 -07:00 committed by GitHub
parent ebe331fdd3
commit 6b1fe8b7a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,6 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
@ -165,7 +164,7 @@ func (b *binary) OpenFile(path ...string) (*os.File, error) {
// directory. // directory.
func (b *binary) ReadFile(path ...string) ([]byte, error) { func (b *binary) ReadFile(path ...string) ([]byte, error) {
flatPath := b.Path(path...) flatPath := b.Path(path...)
return ioutil.ReadFile(flatPath) return os.ReadFile(flatPath)
} }
// FileExists is a helper for easily testing whether a particular file // FileExists is a helper for easily testing whether a particular file
@ -235,7 +234,7 @@ func (b *binary) SetLocalState(state *states.State) error {
func GoBuild(pkgPath, tmpPrefix string) string { func GoBuild(pkgPath, tmpPrefix string) string {
dir, prefix := filepath.Split(tmpPrefix) dir, prefix := filepath.Split(tmpPrefix)
tmpFile, err := ioutil.TempFile(dir, prefix) tmpFile, err := os.CreateTemp(dir, prefix)
if err != nil { if err != nil {
panic(err) panic(err)
} }