From fac4b9d68a0983f73cce88eb6dc93b1e4d83165f Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Sat, 4 Feb 2023 22:57:47 +0800 Subject: [PATCH] Cleanup: remove ioutil for new go version Signed-off-by: xin.li --- controllers/goharbor/harbor/harbor_suite_test.go | 4 ++-- pkg/controller/template.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/controllers/goharbor/harbor/harbor_suite_test.go b/controllers/goharbor/harbor/harbor_suite_test.go index 7ab3def5d..2b33a1bf1 100644 --- a/controllers/goharbor/harbor/harbor_suite_test.go +++ b/controllers/goharbor/harbor/harbor_suite_test.go @@ -2,7 +2,7 @@ package harbor_test import ( "context" - "io/ioutil" + "os" "strings" "testing" @@ -24,7 +24,7 @@ func TestHarbor(t *testing.T) { } func fileString(filePath string) string { - content, err := ioutil.ReadFile(filePath) + content, err := os.ReadFile(filePath) Expect(err).NotTo(HaveOccurred()) return strings.TrimSpace(string(content)) diff --git a/pkg/controller/template.go b/pkg/controller/template.go index 3bfd6e272..e324d171f 100644 --- a/pkg/controller/template.go +++ b/pkg/controller/template.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "text/template" "github.com/Masterminds/sprig" @@ -48,7 +47,7 @@ func (c *Controller) GetTemplatedConfig(ctx context.Context, templateConfig stri errTemplate = t.Execute(writer, owner) }() - configContent, err := ioutil.ReadAll(reader) + configContent, err := io.ReadAll(reader) if errTemplate != nil { if errors.As(err, &template.ExecError{}) {