Stop using deprecated ioutil functions

This commit is contained in:
Katrina Verey
2022-08-10 16:59:18 -04:00
parent 416eed97c4
commit f6b72077c8
70 changed files with 322 additions and 362 deletions

View File

@@ -4,7 +4,7 @@
package internal
import (
"io/ioutil"
"os"
"sigs.k8s.io/yaml"
)
@@ -25,7 +25,7 @@ type PackageSpec struct {
}
func ReadSpec(fileName string) *ModuleSpec {
bytes, err := ioutil.ReadFile(fileName)
bytes, err := os.ReadFile(fileName)
if err != nil {
panic(err)
}

View File

@@ -4,7 +4,6 @@
package internal_test
import (
"io/ioutil"
"os"
"testing"
@@ -51,7 +50,7 @@ func TestReadSpec(t *testing.T) {
// Write content to temp file, returning file name.
func writeFile(t *testing.T, content []byte) string {
f, err := ioutil.TempFile("", "testjunk")
f, err := os.CreateTemp("", "testjunk")
if err != nil {
t.Fatal(err)
}