From d5ca3051621991403d39ccbc6295a0355e01a80e Mon Sep 17 00:00:00 2001 From: Bob Callaway Date: Sat, 14 Dec 2024 12:00:27 -0500 Subject: [PATCH] fix lint Signed-off-by: Bob Callaway --- cmd/cosign/cli/verify/verify_bundle.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/cosign/cli/verify/verify_bundle.go b/cmd/cosign/cli/verify/verify_bundle.go index df768b75bd4..2a944aca39c 100644 --- a/cmd/cosign/cli/verify/verify_bundle.go +++ b/cmd/cosign/cli/verify/verify_bundle.go @@ -173,15 +173,15 @@ func verifyNewBundle(ctx context.Context, bundlePath, trustedRootPath, keyRef, s // Check if artifactRef is a digest or a file path var artifactOpt verify.ArtifactPolicyOption if _, err := os.Stat(artifactRef); err != nil { - if hexAlg, hexDigest, ok := strings.Cut(artifactRef, ":"); !ok { + hexAlg, hexDigest, ok := strings.Cut(artifactRef, ":") + if !ok { + return nil, err + } + digestBytes, err := hex.DecodeString(hexDigest) + if err != nil { return nil, err - } else { - digestBytes, err := hex.DecodeString(hexDigest) - if err != nil { - return nil, err - } - artifactOpt = verify.WithArtifactDigest(hexAlg, digestBytes) } + artifactOpt = verify.WithArtifactDigest(hexAlg, digestBytes) } else { // Perform verification payload, err := payloadBytes(artifactRef)