Skip to content

Commit 4c80d3a

Browse files
authored
Fixed a linter error causing lack of compilation in Go 1.19 by removing deprecated io/ioutil functions and replacing them with their Go 1.16 counterparts. (#439)
1 parent 0c16e53 commit 4c80d3a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cmd/root.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ package cmd
3131
import (
3232
"flag"
3333
"fmt"
34-
"io/ioutil"
34+
"io"
3535
"os"
3636
"strings"
3737

@@ -195,7 +195,7 @@ var rootCmd = &cobra.Command{
195195
var deprecatedVersionList []api.Version
196196
if additionalVersionsFile != "" {
197197
klog.V(2).Infof("looking for versions file: %s", additionalVersionsFile)
198-
data, err := ioutil.ReadFile(additionalVersionsFile)
198+
data, err := os.ReadFile(additionalVersionsFile)
199199
if err != nil {
200200
return err
201201
}
@@ -349,7 +349,7 @@ var detectCmd = &cobra.Command{
349349

350350
if args[0] == "-" {
351351
//stdin
352-
fileData, err := ioutil.ReadAll(os.Stdin)
352+
fileData, err := io.ReadAll(os.Stdin)
353353
if err != nil {
354354
fmt.Println("Error reading stdin:", err)
355355
os.Exit(1)

pkg/finder/finder.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ package finder
3030

3131
import (
3232
"fmt"
33-
"io/ioutil"
3433
"os"
3534
"path/filepath"
3635

@@ -122,7 +121,7 @@ func (dir *Dir) scanFiles() error {
122121
// it is an api-versioned Kubernetes object.
123122
// Returns the File object if it is.
124123
func (dir *Dir) CheckForAPIVersion(file string) ([]*api.Output, error) {
125-
data, err := ioutil.ReadFile(file)
124+
data, err := os.ReadFile(file)
126125
if err != nil {
127126
return nil, err
128127
}

0 commit comments

Comments
 (0)