diff --git a/hack/cmd-docs/main.go b/hack/cmd-docs/main.go index d1fe35c0..462121cf 100644 --- a/hack/cmd-docs/main.go +++ b/hack/cmd-docs/main.go @@ -2,7 +2,6 @@ package main import ( "io/fs" - "io/ioutil" "log" "os" "path/filepath" @@ -55,7 +54,7 @@ func replaceHome() error { log.Printf("replaced home at: %s", fname) - err = ioutil.WriteFile(fname, []byte(newstr), 0422) + err = os.WriteFile(fname, []byte(newstr), 0422) if err != nil { return err } diff --git a/pkg/application/application.go b/pkg/application/application.go index 698e00c8..1c52de33 100644 --- a/pkg/application/application.go +++ b/pkg/application/application.go @@ -3,7 +3,6 @@ package application import ( "errors" "fmt" - "io/ioutil" "os" "path/filepath" "reflect" @@ -512,7 +511,7 @@ func fixResourcesPaths(k *kusttypes.Kustomization, newKustDir string) error { } var generateManifests = func(k *kusttypes.Kustomization) ([]byte, error) { - td, err := ioutil.TempDir(".", "auto-pilot") + td, err := os.MkdirTemp(".", "auto-pilot") if err != nil { return nil, fmt.Errorf("failed creating temp dir: %w", err) } @@ -533,7 +532,7 @@ var generateManifests = func(k *kusttypes.Kustomization) ([]byte, error) { } kustomizationPath := filepath.Join(td, "kustomization.yaml") - if err = ioutil.WriteFile(kustomizationPath, kyaml, 0400); err != nil { + if err = os.WriteFile(kustomizationPath, kyaml, 0400); err != nil { return nil, fmt.Errorf("failed writing file to \"%s\": %w", kustomizationPath, err) } diff --git a/pkg/application/application_test.go b/pkg/application/application_test.go index 82bf6b29..674550b8 100644 --- a/pkg/application/application_test.go +++ b/pkg/application/application_test.go @@ -2,7 +2,7 @@ package application import ( "errors" - "io/ioutil" + "io" "path/filepath" "reflect" "testing" @@ -206,7 +206,7 @@ func Test_writeFile(t *testing.T) { f, err := repofs.Open("/foo/bar") assert.NoError(t, err) - d, err := ioutil.ReadAll(f) + d, err := io.ReadAll(f) assert.NoError(t, err) assert.Equal(t, d, []byte("data")) @@ -226,7 +226,7 @@ func Test_writeFile(t *testing.T) { assert.Equal(t, "/someroot", repofs.Root()) f, err := repofs.Open("/foo/bar") assert.NoError(t, err) - d, err := ioutil.ReadAll(f) + d, err := io.ReadAll(f) assert.NoError(t, err) assert.Equal(t, d, []byte("data2")) diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index f243a95c..19a98feb 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -3,7 +3,7 @@ package fs import ( "encoding/json" "fmt" - "io/ioutil" + "io" "os" "github.com/argoproj-labs/argocd-autopilot/pkg/util" @@ -92,7 +92,7 @@ func (fs *fsimpl) ReadFile(filename string) ([]byte, error) { } defer f.Close() - return ioutil.ReadAll(f) + return io.ReadAll(f) } func (fs *fsimpl) ReadYamls(filename string, o ...interface{}) error {