From 5574ee135fe4464754fc39486eed98803f212b20 Mon Sep 17 00:00:00 2001 From: Supreeth Basabattini Date: Wed, 6 Sep 2023 10:17:15 +0530 Subject: [PATCH] fix: linting errors --- cmd/ocm-backplane/managedJob/createManagedJob_test.go | 8 ++++---- pkg/utils/renderingutils.go | 3 +-- pkg/utils/util.go | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/ocm-backplane/managedJob/createManagedJob_test.go b/cmd/ocm-backplane/managedJob/createManagedJob_test.go index ec5eb58a..d1a7244e 100644 --- a/cmd/ocm-backplane/managedJob/createManagedJob_test.go +++ b/cmd/ocm-backplane/managedJob/createManagedJob_test.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" + "io" "net/http" "os" @@ -174,7 +174,7 @@ var _ = Describe("managedJob create command", func() { Expect(err).To(BeNil()) - outPutText, _ := ioutil.ReadAll(outPuts) + outPutText, _ := io.ReadAll(outPuts) Expect(string(outPutText)).Should(ContainSubstring("Job Succeeded")) }) @@ -222,7 +222,7 @@ var _ = Describe("managedJob create command", func() { Expect(err).To(BeNil()) - outPutText, _ := ioutil.ReadAll(outPuts) + outPutText, _ := io.ReadAll(outPuts) Expect(string(outPutText)).Should(ContainSubstring("Job Failed")) }) @@ -243,7 +243,7 @@ var _ = Describe("managedJob create command", func() { Expect(err).To(BeNil()) - outPutText, _ := ioutil.ReadAll(outPuts) + outPutText, _ := io.ReadAll(outPuts) Expect(string(outPutText)).Should(ContainSubstring("fetching logs for")) }) diff --git a/pkg/utils/renderingutils.go b/pkg/utils/renderingutils.go index 6df9e57e..37406249 100644 --- a/pkg/utils/renderingutils.go +++ b/pkg/utils/renderingutils.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "strings" "text/tabwriter" @@ -100,7 +99,7 @@ func RenderTable(headers []string, data [][]string) { // RenderJSON is an effectual function that renders the reader as JSON // returns err if render fails func RenderJSON(reader io.Reader) error { - body, err := ioutil.ReadAll(reader) + body, err := io.ReadAll(reader) if err != nil { return err } diff --git a/pkg/utils/util.go b/pkg/utils/util.go index 6082327d..727c6474 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -3,7 +3,7 @@ package utils import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net" "net/http" "os" @@ -104,7 +104,7 @@ func MatchBaseDomain(longHostname, baseDomain string) bool { } func TryParseBackplaneAPIError(rsp *http.Response) (*BackplaneApi.Error, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err