Skip to content

Commit

Permalink
removed depracted ioutil references (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitKochhar authored Aug 28, 2023
1 parent 978c316 commit 060af02
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -184,7 +183,7 @@ func downloadConfig(cfgURL string) (string, error) {
segments := strings.Split(path, "/")
fileName := segments[len(segments)-1]

file, err := ioutil.TempFile("", fmt.Sprintf("*-%s", fileName))
file, err := os.CreateTemp("", fmt.Sprintf("*-%s", fileName))
if err != nil {
return "", err
}
Expand Down Expand Up @@ -380,7 +379,7 @@ func handleHelm(kubeContext string) (*output.Output, error) {
}
packages, err := ahClient.List()
if err != nil {
return nil, fmt.Errorf("Error getting artifacthub package repos: %v", err)
return nil, fmt.Errorf("error getting artifacthub package repos: %v", err)
}
klog.V(2).Infof("found %d possible package matches", len(packages))
for _, release := range releases {
Expand Down
3 changes: 1 addition & 2 deletions pkg/helm/artifacthub_cached.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package helm
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -108,7 +107,7 @@ func (ac *ArtifactHubCachedPackageClient) List() ([]ArtifactHubHelmPackage, erro
return nil, err
}
} else {
cache, err := ioutil.ReadFile(cacheFile)
cache, err := os.ReadFile(cacheFile)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/helm/chartrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package helm

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"sync"
"time"
Expand Down Expand Up @@ -99,7 +99,7 @@ func (r *Repo) loadReleases() error {
return err
}

data, err := ioutil.ReadAll(response.Body)
data, err := io.ReadAll(response.Body)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"path"
"strconv"
Expand Down Expand Up @@ -129,7 +128,7 @@ func (output Output) ToFile(filename string) error {
return err
}

err = ioutil.WriteFile(filename, data, 0644)
err = os.WriteFile(filename, data, 0644)
if err != nil {
klog.Errorf("Error writing to file %s: %v", filename, err)
}
Expand Down Expand Up @@ -397,7 +396,7 @@ func (output HelmAndContainersOutput) ToFile(filename string) error {
klog.Errorf("Error marshaling json: %v", err)
return err
}
err = ioutil.WriteFile(filename, data, 0644)
err = os.WriteFile(filename, data, 0644)
if err != nil {
klog.Errorf("Error writing to file %s: %v", filename, err)
}
Expand Down

0 comments on commit 060af02

Please sign in to comment.