Replace all calls to ioutil.ReadDir

https://golang.org/doc/go1.16\#ioutil
Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
pull/9635/head
Marco Franssen 5 years ago
parent c6a343f99a
commit 04cd52b9aa
No known key found for this signature in database
GPG Key ID: 63B0C3B53E26CEBD

@ -21,7 +21,6 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -341,7 +340,7 @@ func compListCharts(toComplete string, includeFiles bool) ([]string, cobra.Shell
// listing the entire content of the current directory which will // listing the entire content of the current directory which will
// be too many choices for the user to find the real repos) // be too many choices for the user to find the real repos)
if includeFiles && len(completions) > 0 && len(toComplete) > 0 { 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 { for _, file := range files {
if strings.HasPrefix(file.Name(), toComplete) { if strings.HasPrefix(file.Name(), toComplete) {
// We are completing a file prefix // We are completing a file prefix

@ -33,7 +33,6 @@ package fs
import ( import (
"io" "io"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -119,7 +118,7 @@ func CopyDir(src, dst string) error {
return errors.Wrapf(err, "cannot mkdir %s", dst) return errors.Wrapf(err, "cannot mkdir %s", dst)
} }
entries, err := ioutil.ReadDir(src) entries, err := os.ReadDir(src)
if err != nil { if err != nil {
return errors.Wrapf(err, "cannot read directory %s", dst) return errors.Wrapf(err, "cannot read directory %s", dst)
} }

@ -17,7 +17,6 @@ limitations under the License.
package action package action
import ( import (
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -96,7 +95,7 @@ func lintChart(path string, vals map[string]interface{}, namespace string, stric
return linter, errors.Wrap(err, "unable to extract tarball") return linter, errors.Wrap(err, "unable to extract tarball")
} }
files, err := ioutil.ReadDir(tempDir) files, err := os.ReadDir(tempDir)
if err != nil { if err != nil {
return linter, errors.Wrapf(err, "unable to read temporary output directory %s", tempDir) return linter, errors.Wrapf(err, "unable to read temporary output directory %s", tempDir)
} }

@ -20,7 +20,6 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"log" "log"
"net/url" "net/url"
"os" "os"
@ -862,7 +861,7 @@ func tarFromLocalDir(chartpath, name, repo, version string) (string, error) {
// move files from tmppath to destpath // move files from tmppath to destpath
func move(tmpPath, destPath string) error { func move(tmpPath, destPath string) error {
files, _ := ioutil.ReadDir(tmpPath) files, _ := os.ReadDir(tmpPath)
for _, file := range files { for _, file := range files {
filename := file.Name() filename := file.Name()
tmpfile := filepath.Join(tmpPath, filename) tmpfile := filepath.Join(tmpPath, filename)

Loading…
Cancel
Save