Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Hayden Blauzvern <[email protected]>
  • Loading branch information
haydentherapper committed Feb 8, 2022
1 parent 6b3a143 commit cb78b01
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pkg/cosign/tlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func GetRekorPubs(ctx context.Context) ([]*ecdsa.PublicKey, error) {
if err != nil {
return nil, err
}
var publicKeys []*ecdsa.PublicKey
publicKeys := make([]*ecdsa.PublicKey, 0, len(targets))
for _, t := range targets {
rekorPubKey, err := PemToECDSAKey(t.Target)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cosign/tuf/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ func TestGetTargetsByMeta(t *testing.T) {
}

tufObj, err := NewFromEnv(ctx)
defer tufObj.Close()
if err != nil {
t.Fatal(err)
}
defer tufObj.Close()
// Fetch a target with no custom metadata.
targets, err := tufObj.GetTargetsByMeta(UnknownUsage, []string{"fooNoCustom.txt"})
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions pkg/cosign/tuf/status_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package tuf
import (
"fmt"
"strings"

"github.com/pkg/errors"
)

type StatusKind int
Expand All @@ -42,7 +40,7 @@ func (s StatusKind) String() string {
func (s StatusKind) MarshalText() ([]byte, error) {
str := s.String()
if len(str) == 0 {
return nil, errors.New(fmt.Sprintf("error while marshalling, int(StatusKind)=%d not valid", int(s)))
return nil, fmt.Errorf("error while marshalling, int(StatusKind)=%d not valid", int(s))
}
return []byte(s.String()), nil
}
Expand All @@ -56,7 +54,7 @@ func (s *StatusKind) UnmarshalText(text []byte) error {
case "expired":
*s = Expired
default:
return errors.New(fmt.Sprintf("error while unmarshalling, StatusKind=%v not valid", string(text)))
return fmt.Errorf("error while unmarshalling, StatusKind=%v not valid", string(text))
}
return nil
}
6 changes: 2 additions & 4 deletions pkg/cosign/tuf/usage_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ package tuf
import (
"fmt"
"strings"

"github.com/pkg/errors"
)

type UsageKind int
Expand All @@ -44,7 +42,7 @@ func (u UsageKind) String() string {
func (u UsageKind) MarshalText() ([]byte, error) {
str := u.String()
if len(str) == 0 {
return nil, errors.New(fmt.Sprintf("error while marshalling, int(UsageKind)=%d not valid", int(u)))
return nil, fmt.Errorf("error while marshalling, int(UsageKind)=%d not valid", int(u))
}
return []byte(u.String()), nil
}
Expand All @@ -60,7 +58,7 @@ func (u *UsageKind) UnmarshalText(text []byte) error {
case "ctfe":
*u = CTFE
default:
return errors.New(fmt.Sprintf("error while unmarshalling, UsageKind=%v not valid", string(text)))
return fmt.Errorf("error while unmarshalling, UsageKind=%v not valid", string(text))
}
return nil
}

0 comments on commit cb78b01

Please sign in to comment.