From ab30e73e8025cb5f4c4e37f2deb49345becbe337 Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Thu, 21 Oct 2021 12:56:24 +0000 Subject: [PATCH] refactor: enable errorlint linter --- .golangci.yml | 1 + pkg/integrity/metadata.go | 2 ++ pkg/integrity/select.go | 1 + pkg/integrity/verify.go | 1 + pkg/sif/descriptor_input.go | 1 + 5 files changed, 6 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 2d5daecc..8ec3b21b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,6 +13,7 @@ linters: - dupl - errcheck - errname + - errorlint - exportloopref - gochecknoinits - gocritic diff --git a/pkg/integrity/metadata.go b/pkg/integrity/metadata.go index c6c2d00f..fb4be1ec 100644 --- a/pkg/integrity/metadata.go +++ b/pkg/integrity/metadata.go @@ -40,6 +40,7 @@ func (e *DescriptorIntegrityError) Error() string { // Is compares e against target. If target is a DescriptorIntegrityError and matches e or target // has a zero value ID, true is returned. func (e *DescriptorIntegrityError) Is(target error) bool { + //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*DescriptorIntegrityError) if !ok { return false @@ -62,6 +63,7 @@ func (e *ObjectIntegrityError) Error() string { // Is compares e against target. If target is a ObjectIntegrityError and matches e or target has a // zero value ID, true is returned. func (e *ObjectIntegrityError) Is(target error) bool { + //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*ObjectIntegrityError) if !ok { return false diff --git a/pkg/integrity/select.go b/pkg/integrity/select.go index 75f24a00..3f2e794a 100644 --- a/pkg/integrity/select.go +++ b/pkg/integrity/select.go @@ -67,6 +67,7 @@ func (e *SignatureNotFoundError) Error() string { // Is compares e against target. If target is a SignatureNotFoundError and matches e or target has // a zero value ID, true is returned. func (e *SignatureNotFoundError) Is(target error) bool { + //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*SignatureNotFoundError) if !ok { return false diff --git a/pkg/integrity/verify.go b/pkg/integrity/verify.go index b512ada5..ef9e3e52 100644 --- a/pkg/integrity/verify.go +++ b/pkg/integrity/verify.go @@ -52,6 +52,7 @@ func (e *SignatureNotValidError) Unwrap() error { // Is compares e against target. If target is a SignatureNotValidError and matches e or target has // a zero value ID, true is returned. func (e *SignatureNotValidError) Is(target error) bool { + //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*SignatureNotValidError) if !ok { return false diff --git a/pkg/sif/descriptor_input.go b/pkg/sif/descriptor_input.go index 4d14e958..7ae171fe 100644 --- a/pkg/sif/descriptor_input.go +++ b/pkg/sif/descriptor_input.go @@ -103,6 +103,7 @@ func (e *unexpectedDataTypeError) Error() string { } func (e *unexpectedDataTypeError) Is(target error) bool { + //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*unexpectedDataTypeError) if !ok { return false