Drop deprecated ioutil
`ioutil` has been deprecated by golang. All the code in `ioutil` just forwards functionality to code in either the `io` or `os` packages. See https://github.com/golang/go/pull/51961 for more info. Signed-off-by: Jeff Widman <jeff@jeffwidman.com>
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@@ -1524,14 +1523,14 @@ func writeFilesToTempDir(tmpDirPattern string, content []string) (string, error)
|
||||
return "", nil
|
||||
}
|
||||
|
||||
dir, err := ioutil.TempDir("", tmpDirPattern)
|
||||
dir, err := os.MkdirTemp("", tmpDirPattern)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for idx, data := range content {
|
||||
file := filepath.Join(dir, fmt.Sprintf("spec-%d.yaml", idx))
|
||||
err := ioutil.WriteFile(file, []byte(data), 0644)
|
||||
err := os.WriteFile(file, []byte(data), 0644)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@@ -1524,14 +1523,14 @@ func writeFilesToTempDir(tmpDirPattern string, content []string) (string, error)
|
||||
return "", nil
|
||||
}
|
||||
|
||||
dir, err := ioutil.TempDir("", tmpDirPattern)
|
||||
dir, err := os.MkdirTemp("", tmpDirPattern)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for idx, data := range content {
|
||||
file := filepath.Join(dir, fmt.Sprintf("spec-%d.yaml", idx))
|
||||
err := ioutil.WriteFile(file, []byte(data), 0644)
|
||||
err := os.WriteFile(file, []byte(data), 0644)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user