Skip to content

Commit

Permalink
fixed some lint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Noam Gal <[email protected]>
  • Loading branch information
ATGardner committed Nov 10, 2022
1 parent af907ab commit 7967892
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions hack/cmd-docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"io/fs"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package application
import (
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/application/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package application

import (
"errors"
"io/ioutil"
"io"
"path/filepath"
"reflect"
"testing"
Expand Down Expand Up @@ -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"))
Expand All @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions pkg/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fs
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"

"github.com/argoproj-labs/argocd-autopilot/pkg/util"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 7967892

Please sign in to comment.