mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Stop using deprecated ioutil functions
This commit is contained in:
@@ -10,7 +10,6 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -78,7 +77,7 @@ func (p *HelmChartInflationGeneratorPlugin) establishTmpDir() (err error) {
|
||||
// already done.
|
||||
return nil
|
||||
}
|
||||
p.tmpDir, err = ioutil.TempDir("", "kustomize-helm-")
|
||||
p.tmpDir, err = os.MkdirTemp("", "kustomize-helm-")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -216,7 +215,7 @@ func (p *HelmChartInflationGeneratorPlugin) writeValuesBytes(
|
||||
return "", fmt.Errorf("cannot create tmp dir to write helm values")
|
||||
}
|
||||
path := filepath.Join(p.tmpDir, p.Name+"-kustomize-values.yaml")
|
||||
return path, ioutil.WriteFile(path, b, 0644)
|
||||
return path, os.WriteFile(path, b, 0644)
|
||||
}
|
||||
|
||||
func (p *HelmChartInflationGeneratorPlugin) cleanup() {
|
||||
|
||||
@@ -5,7 +5,7 @@ package main_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
@@ -473,7 +473,7 @@ func TestHelmChartInflationGeneratorWithIncludeCRDs(t *testing.T) {
|
||||
|
||||
// we store this data outside of the _test.go file as its sort of huge
|
||||
// and has backticks, which makes string literals wonky
|
||||
testData, err := ioutil.ReadFile("include_crds_testdata.txt")
|
||||
testData, err := os.ReadFile("include_crds_testdata.txt")
|
||||
if err != nil {
|
||||
t.Error(fmt.Errorf("unable to read test data for includeCRDs: %w", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user