Skip to content

Commit

Permalink
fix: golangci-lint failing due nil check (#333)
Browse files Browse the repository at this point in the history
Added the fix and introduced `make lint` for local tests

dsse/verify.go:98:6: S1009: should omit nil check; len() for []byte is defined as zero (gosimple)
                if sig.Certificate != nil && len(sig.Certificate) > 0 {
                   ^

Signed-off-by: Kairo Araujo <[email protected]>
  • Loading branch information
kairoaraujo authored Aug 22, 2024
1 parent e8606a9 commit 6f4bff5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ schema: ## Generate the attestor schema json files

help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

lint: ## Run the linter
@golangci-lint run
@go fmt ./...
@go vet ./...
2 changes: 1 addition & 1 deletion dsse/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (e Envelope) Verify(opts ...VerificationOption) ([]CheckedVerifier, error)
checkedVerifiers := make([]CheckedVerifier, 0)
verified := 0
for _, sig := range e.Signatures {
if sig.Certificate != nil && len(sig.Certificate) > 0 {
if len(sig.Certificate) > 0 {
cert, err := cryptoutil.TryParseCertificate(sig.Certificate)
if err != nil {
continue
Expand Down

0 comments on commit 6f4bff5

Please sign in to comment.