mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Stop using deprecated ioutil functions
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -130,7 +130,7 @@ func (c *Converter) readEmbeddedFile(name string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
defer r.Close()
|
||||
contents, err := ioutil.ReadAll(r)
|
||||
contents, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (c *Converter) readEmbeddedFile(name string) (string, error) {
|
||||
}
|
||||
|
||||
func (c *Converter) readDiskFile(path string) (string, error) {
|
||||
f, err := ioutil.ReadFile(path)
|
||||
f, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -159,7 +159,7 @@ func (c *Converter) mkDstDir() error {
|
||||
func (c *Converter) write(m map[string]string) error {
|
||||
for k, v := range m {
|
||||
p := filepath.Join(c.outputDir, k)
|
||||
err := ioutil.WriteFile(p, []byte(v), 0644)
|
||||
err := os.WriteFile(p, []byte(v), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package krmfunction
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -116,7 +116,7 @@ func TestTransformerConverter(t *testing.T) {
|
||||
t.Skip("TODO: fix this test, which was not running in CI and does not pass")
|
||||
dir := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(dir, "Plugin.go"),
|
||||
err := os.WriteFile(filepath.Join(dir, "Plugin.go"),
|
||||
getTransformerCode(), 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -214,7 +214,7 @@ func TestGeneratorConverter(t *testing.T) {
|
||||
t.Skip("TODO: fix this test, which was not running in CI and does not pass")
|
||||
dir := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(dir, "Plugin.go"),
|
||||
err := os.WriteFile(filepath.Join(dir, "Plugin.go"),
|
||||
getGeneratorCode(), 0644)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user