Skip to content

Commit

Permalink
fix: enable errorlint linter (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobe4 authored Jan 2, 2025
1 parent 30f7e9a commit 776e96e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
- cyclop
- depguard
- err113
- errorlint
- forbidigo
- gochecknoglobals
- gochecknoinits
Expand Down
2 changes: 1 addition & 1 deletion internal/actions/assign/assign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestRun(t *testing.T) {
},
}

if err := runner.Run(n, []string{"user"}, w); err != expectedError {
if err := runner.Run(n, []string{"user"}, w); !errors.Is(err, expectedError) {
t.Fatalf("expected %#v but got %#v", expectedError, err)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/gh/gh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func TestRequest(t *testing.T) {
t.Errorf("expected test to fails")
}

if err != expectedError {
if !errors.Is(err, expectedError) {
t.Errorf("expected %#v, got %#v", expectedError, err)
}

Expand Down Expand Up @@ -576,7 +576,7 @@ func TestEnrich(t *testing.T) {
notification: mockNotification(0),
assertError: func(t *testing.T, err error) {
t.Helper()
if err != errSample {
if !errors.Is(err, errSample) {
t.Errorf("expected to fail with %#v but got %#v", errSample, err)
}
},
Expand Down
6 changes: 4 additions & 2 deletions internal/jq/jq.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jq

import (
"errors"
"fmt"

"github.com/itchyny/gojq"
Expand Down Expand Up @@ -39,8 +40,9 @@ func Filter(filter string, n notifications.Notifications) (notifications.Notific
break
}

if err, ok := v.(error); ok {
if err, ok := err.(*gojq.HaltError); ok && err.Value() == nil {
if err, ok = v.(error); ok {
haltError := &gojq.HaltError{}
if ok = errors.As(err, &haltError); ok && haltError.Value() == nil {
break
}
return nil, err
Expand Down

0 comments on commit 776e96e

Please sign in to comment.