From fc367c1067d46957d90a1fa666a96fd0f84cf537 Mon Sep 17 00:00:00 2001 From: guangwu Date: Thu, 31 Aug 2023 22:33:05 +0800 Subject: [PATCH] chore: remove refs to deprecated io/ioutil (#9061) Signed-off-by: guoguangwu --- pkg/skaffold/inspect/jobManifestPaths/modify.go | 3 +-- pkg/skaffold/inspect/namespaces/list.go | 4 ++-- pkg/skaffold/k8sjob/util.go | 4 ++-- pkg/skaffold/render/renderer/kustomize/kustomize.go | 5 ++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/skaffold/inspect/jobManifestPaths/modify.go b/pkg/skaffold/inspect/jobManifestPaths/modify.go index 5f0610f0fbd..69afb4d8ff4 100644 --- a/pkg/skaffold/inspect/jobManifestPaths/modify.go +++ b/pkg/skaffold/inspect/jobManifestPaths/modify.go @@ -21,7 +21,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/config" @@ -46,7 +45,7 @@ func Modify(ctx context.Context, out io.Writer, opts config.SkaffoldOptions, inp // defer the closing of our jsonFile so that we can parse it later on defer jsonFile.Close() - byteValue, _ := ioutil.ReadAll(jsonFile) + byteValue, _ := io.ReadAll(jsonFile) var result jobManifestPathList err = json.Unmarshal(byteValue, &result) diff --git a/pkg/skaffold/inspect/namespaces/list.go b/pkg/skaffold/inspect/namespaces/list.go index 7bdcf8146c7..a1aac459331 100644 --- a/pkg/skaffold/inspect/namespaces/list.go +++ b/pkg/skaffold/inspect/namespaces/list.go @@ -19,8 +19,8 @@ package inspect import ( "context" "io" - "io/ioutil" "log" + "os" "strings" appsv1 "k8s.io/api/apps/v1" @@ -42,7 +42,7 @@ type resourceInfo struct { } func PrintNamespacesList(ctx context.Context, out io.Writer, manifestFile string, opts inspect.Options) error { - b, err := ioutil.ReadFile(manifestFile) + b, err := os.ReadFile(manifestFile) if err != nil { return err } diff --git a/pkg/skaffold/k8sjob/util.go b/pkg/skaffold/k8sjob/util.go index 6242d1c4f73..3b240df4811 100644 --- a/pkg/skaffold/k8sjob/util.go +++ b/pkg/skaffold/k8sjob/util.go @@ -19,7 +19,7 @@ package k8sjob import ( "context" "fmt" - "io/ioutil" + "os" "time" jsonpatch "github.com/evanphx/json-patch" @@ -70,7 +70,7 @@ func merge(codec runtime.Codec, dst runtime.Object, fragment string) (runtime.Ob } func LoadFromPath(path string) (*batchv1.Job, error) { - b, err := ioutil.ReadFile(path) + b, err := os.ReadFile(path) if err != nil { return nil, err diff --git a/pkg/skaffold/render/renderer/kustomize/kustomize.go b/pkg/skaffold/render/renderer/kustomize/kustomize.go index d3548cf1273..b5b4c9405cb 100644 --- a/pkg/skaffold/render/renderer/kustomize/kustomize.go +++ b/pkg/skaffold/render/renderer/kustomize/kustomize.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -162,7 +161,7 @@ func (k Kustomize) mirror(kusDir string, fs TmpFS) error { return err } - bytes, err := ioutil.ReadFile(kFile) + bytes, err := os.ReadFile(kFile) if err != nil { return err } @@ -300,7 +299,7 @@ func (k Kustomize) mirrorFile(kusDir string, fs TmpFS, path string) error { return nil } pFile := filepath.Join(kusDir, path) - bytes, err := ioutil.ReadFile(pFile) + bytes, err := os.ReadFile(pFile) if err != nil { return err }