From 7142c8efd4ad9afd6b57113d0d726934444f704f Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Thu, 23 Feb 2023 21:15:12 +0530 Subject: [PATCH] Not use io/ioutil package anymore This will move io/ioutil package usages to os --- pkg/cmd/pipeline/sign.go | 6 ++--- pkg/cmd/pipeline/sign_test.go | 3 +-- pkg/cmd/pipeline/verify.go | 4 +-- pkg/cmd/task/sign.go | 4 +-- pkg/cmd/task/sign_test.go | 3 +-- pkg/cmd/task/verify.go | 4 +-- pkg/trustedresources/sign_test.go | 3 +-- .../grpc-ecosystem/grpc-gateway/LICENSE.txt | 27 ------------------- 8 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 third_party/VENDOR-LICENSE/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt diff --git a/pkg/cmd/pipeline/sign.go b/pkg/cmd/pipeline/sign.go index e1c4859be1..0b7b6d89da 100644 --- a/pkg/cmd/pipeline/sign.go +++ b/pkg/cmd/pipeline/sign.go @@ -16,8 +16,8 @@ package pipeline import ( "fmt" - "io/ioutil" "log" + "os" "github.com/spf13/cobra" "github.com/tektoncd/cli/pkg/cli" @@ -64,7 +64,7 @@ or using kms Err: cmd.OutOrStderr(), } - b, err := ioutil.ReadFile(args[0]) + b, err := os.ReadFile(args[0]) if err != nil { log.Fatalf("error reading file: %v", err) return err @@ -92,7 +92,7 @@ or using kms } func (s *signOptions) Run(args []string) error { - tsBuf, err := ioutil.ReadFile(args[0]) + tsBuf, err := os.ReadFile(args[0]) if err != nil { log.Fatalf("error reading file: %v", err) return err diff --git a/pkg/cmd/pipeline/sign_test.go b/pkg/cmd/pipeline/sign_test.go index 63c71179cd..8078df5855 100644 --- a/pkg/cmd/pipeline/sign_test.go +++ b/pkg/cmd/pipeline/sign_test.go @@ -16,7 +16,6 @@ package pipeline import ( "context" - "io/ioutil" "os" "path/filepath" "testing" @@ -48,7 +47,7 @@ func TestSign(t *testing.T) { t.Errorf("error getting verifier from key file: %v", err) } - signed, err := ioutil.ReadFile(targetFile) + signed, err := os.ReadFile(targetFile) if err != nil { t.Fatalf("error reading file: %v", err) } diff --git a/pkg/cmd/pipeline/verify.go b/pkg/cmd/pipeline/verify.go index 4739312840..e94f8d4af7 100644 --- a/pkg/cmd/pipeline/verify.go +++ b/pkg/cmd/pipeline/verify.go @@ -16,8 +16,8 @@ package pipeline import ( "fmt" - "io/ioutil" "log" + "os" "github.com/spf13/cobra" "github.com/tektoncd/cli/pkg/cli" @@ -62,7 +62,7 @@ or using kms Out: cmd.OutOrStdout(), Err: cmd.OutOrStderr(), } - b, err := ioutil.ReadFile(args[0]) + b, err := os.ReadFile(args[0]) if err != nil { log.Fatalf("error reading file: %v", err) return err diff --git a/pkg/cmd/task/sign.go b/pkg/cmd/task/sign.go index 0cb11d7970..2981a1c747 100644 --- a/pkg/cmd/task/sign.go +++ b/pkg/cmd/task/sign.go @@ -16,8 +16,8 @@ package task import ( "fmt" - "io/ioutil" "log" + "os" "github.com/spf13/cobra" "github.com/tektoncd/cli/pkg/cli" @@ -69,7 +69,7 @@ or using kms Err: cmd.OutOrStderr(), } - b, err := ioutil.ReadFile(args[0]) + b, err := os.ReadFile(args[0]) if err != nil { log.Fatalf("error reading file: %v", err) return err diff --git a/pkg/cmd/task/sign_test.go b/pkg/cmd/task/sign_test.go index 1035906256..dab9f2da07 100644 --- a/pkg/cmd/task/sign_test.go +++ b/pkg/cmd/task/sign_test.go @@ -16,7 +16,6 @@ package task import ( "context" - "io/ioutil" "os" "path/filepath" "testing" @@ -48,7 +47,7 @@ func TestSign(t *testing.T) { t.Errorf("error getting verifier from key file: %v", err) } - signed, err := ioutil.ReadFile(targetFile) + signed, err := os.ReadFile(targetFile) if err != nil { t.Fatalf("error reading file: %v", err) } diff --git a/pkg/cmd/task/verify.go b/pkg/cmd/task/verify.go index 4c3dfb8d70..5cec3a1d4a 100644 --- a/pkg/cmd/task/verify.go +++ b/pkg/cmd/task/verify.go @@ -16,8 +16,8 @@ package task import ( "fmt" - "io/ioutil" "log" + "os" "github.com/spf13/cobra" "github.com/tektoncd/cli/pkg/cli" @@ -62,7 +62,7 @@ or using kms Out: cmd.OutOrStdout(), Err: cmd.OutOrStderr(), } - b, err := ioutil.ReadFile(args[0]) + b, err := os.ReadFile(args[0]) if err != nil { log.Fatalf("error reading file: %v", err) return err diff --git a/pkg/trustedresources/sign_test.go b/pkg/trustedresources/sign_test.go index cf53985542..bd8c9d3301 100644 --- a/pkg/trustedresources/sign_test.go +++ b/pkg/trustedresources/sign_test.go @@ -23,7 +23,6 @@ import ( "crypto/rand" "crypto/x509" "encoding/pem" - "io/ioutil" "os" "path/filepath" "testing" @@ -97,7 +96,7 @@ func TestSign(t *testing.T) { if err := Sign(tc.resource, filepath.Join(tmpDir, privateKeyFile), "", filepath.Join(tmpDir, tc.targetFile)); err != nil { t.Fatalf("Sign() get err %v", err) } - signed, err := ioutil.ReadFile(filepath.Join(tmpDir, tc.targetFile)) + signed, err := os.ReadFile(filepath.Join(tmpDir, tc.targetFile)) if err != nil { t.Fatalf("error reading file: %v", err) } diff --git a/third_party/VENDOR-LICENSE/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt b/third_party/VENDOR-LICENSE/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt deleted file mode 100644 index 364516251b..0000000000 --- a/third_party/VENDOR-LICENSE/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015, Gengo, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Gengo, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.