Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore]: enable error-nil and nil-compare rules from testifylint #6133

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,9 @@ linters-settings:
disable:
- compares
- error-is-as
- error-nil
- expected-actual
- float-compare
- formatter
- go-require
- negative-positive
- nil-compare
- require-error
2 changes: 1 addition & 1 deletion bridges/prometheus/producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func TestProduce(t *testing.T) {
p := NewMetricProducer(WithGatherer(reg))
output, err := p.Produce(context.Background())
if tt.wantErr == nil {
assert.Nil(t, err)
assert.NoError(t, err)
}
require.Equal(t, len(output), len(tt.expected))
for i := range output {
Expand Down
2 changes: 1 addition & 1 deletion detectors/aws/ecs/ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func TestDetectCannotReadContainerID(t *testing.T) {
detector := &resourceDetector{utils: detectorUtils}
res, err := detector.Detect(context.Background())

assert.Equal(t, nil, err)
assert.NoError(t, err)
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}

Expand Down
8 changes: 4 additions & 4 deletions detectors/aws/ecs/test/ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestDetectV4LaunchTypeEc2(t *testing.T) {
detector := ecs.NewResourceDetector()
res, err := detector.Detect(context.Background())

assert.Equal(t, nil, err, "Detector should not fail")
assert.NoError(t, err, "Detector should not fail")
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}

Expand Down Expand Up @@ -139,7 +139,7 @@ func TestDetectV4LaunchTypeEc2BadContainerArn(t *testing.T) {
detector := ecs.NewResourceDetector()
res, err := detector.Detect(context.Background())

assert.Equal(t, nil, err, "Detector should not fail")
assert.NoError(t, err, "Detector should not fail")
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}

Expand Down Expand Up @@ -199,7 +199,7 @@ func TestDetectV4LaunchTypeEc2BadTaskArn(t *testing.T) {
detector := ecs.NewResourceDetector()
res, err := detector.Detect(context.Background())

assert.Equal(t, nil, err, "Detector should not fail")
assert.NoError(t, err, "Detector should not fail")
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}

Expand Down Expand Up @@ -259,6 +259,6 @@ func TestDetectV4LaunchTypeFargate(t *testing.T) {
detector := ecs.NewResourceDetector()
res, err := detector.Detect(context.Background())

assert.Equal(t, nil, err, "Detector should not fail")
assert.NoError(t, err, "Detector should not fail")
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}
2 changes: 1 addition & 1 deletion detectors/aws/lambda/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestDetectSuccess(t *testing.T) {
detector := resourceDetector{}
res, err := detector.Detect(context.Background())

assert.Nil(t, err, "Detector unexpectedly returned error")
assert.NoError(t, err, "Detector unexpectedly returned error")
assert.Equal(t, expectedResource, res, "Resource returned is incorrect")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestAppendMiddlewares(t *testing.T) {
if c.expectedError == codes.Unset {
assert.NoError(t, err)
} else {
assert.NotNil(t, err)
assert.Error(t, err)
}

spans := sr.Ended()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestDynamodbTags(t *testing.T) {
if cases.expectedError == codes.Unset {
assert.NoError(t, err)
} else {
assert.NotNil(t, err)
assert.Error(t, err)
}

spans := sr.Ended()
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestDynamodbTagsCustomSetter(t *testing.T) {
if cases.expectedError == codes.Unset {
assert.NoError(t, err)
} else {
assert.NotNil(t, err)
assert.Error(t, err)
}

spans := sr.Ended()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func TestStreamClientInterceptorOnUnidirectionalClientServerStream(t *testing.T)
// and RecvMsg() calls.
_ = streamClient.CloseSend()
err := streamClient.RecvMsg(reply)
require.Nil(t, err)
require.NoError(t, err)

// wait for span end that is called in separate go routine
var span trace.ReadOnlySpan
Expand Down
2 changes: 1 addition & 1 deletion samplers/aws/xray/internal/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func TestMatchAgainstManifestRulesAttributeWildCardMatch(t *testing.T) {
require.NoError(t, err)

// assert that manifest rule r1 is a match
assert.Nil(t, err)
assert.NoError(t, err)
assert.Equal(t, *exp, r1)
}

Expand Down
Loading