Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not use io/ioutil package anymore #1912

Merged
merged 1 commit into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/cmd/pipeline/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package pipeline

import (
"fmt"
"io/ioutil"
"log"
"os"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pkg/cmd/pipeline/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package pipeline

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/pipeline/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package pipeline

import (
"fmt"
"io/ioutil"
"log"
"os"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/task/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package task

import (
"fmt"
"io/ioutil"
"log"
"os"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pkg/cmd/task/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package task

import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/task/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package task

import (
"fmt"
"io/ioutil"
"log"
"os"

"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pkg/trustedresources/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"crypto/rand"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -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)
}
Expand Down

This file was deleted.