Skip to content

Commit

Permalink
Merge pull request #9929 from goodfirstissue/main
Browse files Browse the repository at this point in the history
refactor: use os instead of ioutil's ReadDir
  • Loading branch information
hickeyma committed Jul 12, 2021
2 parents 4bb28b7 + f9b1445 commit 433b90c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cmd/helm/dependency_update_test.go
Expand Up @@ -17,7 +17,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -188,7 +187,7 @@ func TestDependencyUpdateCmd_DoNotDeleteOldChartsOnError(t *testing.T) {
}

// Make sure charts dir still has dependencies
files, err := ioutil.ReadDir(filepath.Join(dir(chartname), "charts"))
files, err := os.ReadDir(filepath.Join(dir(chartname), "charts"))
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/helm/search_repo.go
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"

Expand Down Expand Up @@ -340,7 +341,7 @@ func compListCharts(toComplete string, includeFiles bool) ([]string, cobra.Shell
// listing the entire content of the current directory which will
// be too many choices for the user to find the real repos)
if includeFiles && len(completions) > 0 && len(toComplete) > 0 {
if files, err := ioutil.ReadDir("."); err == nil {
if files, err := os.ReadDir("."); err == nil {
for _, file := range files {
if strings.HasPrefix(file.Name(), toComplete) {
// We are completing a file prefix
Expand Down
3 changes: 1 addition & 2 deletions internal/third_party/dep/fs/fs.go
Expand Up @@ -33,7 +33,6 @@ package fs

import (
"io"
"io/ioutil"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -119,7 +118,7 @@ func CopyDir(src, dst string) error {
return errors.Wrapf(err, "cannot mkdir %s", dst)
}

entries, err := ioutil.ReadDir(src)
entries, err := os.ReadDir(src)
if err != nil {
return errors.Wrapf(err, "cannot read directory %s", dst)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/action/lint.go
Expand Up @@ -96,7 +96,7 @@ func lintChart(path string, vals map[string]interface{}, namespace string, stric
return linter, errors.Wrap(err, "unable to extract tarball")
}

files, err := ioutil.ReadDir(tempDir)
files, err := os.ReadDir(tempDir)
if err != nil {
return linter, errors.Wrapf(err, "unable to read temporary output directory %s", tempDir)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/downloader/manager.go
Expand Up @@ -870,7 +870,7 @@ func tarFromLocalDir(chartpath, name, repo, version string) (string, error) {

// move files from tmppath to destpath
func move(tmpPath, destPath string) error {
files, _ := ioutil.ReadDir(tmpPath)
files, _ := os.ReadDir(tmpPath)
for _, file := range files {
filename := file.Name()
tmpfile := filepath.Join(tmpPath, filename)
Expand Down

0 comments on commit 433b90c

Please sign in to comment.