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

test: remove redundant error check #1741

Merged
merged 1 commit into from
Mar 28, 2024

Conversation

alexandear
Copy link
Contributor

This PR simplifies err == nil || err != nil && !strings.EqualFold(err.Error(), "timeout") statement. If the first err is non-nil then the second err is automatically non-nil.

The redundancy is found by govet's nilness check:

❯ ./bin/golangci-lint run
server_test.go:4149:24: nilness: tautological condition: non-nil != nil (govet)
                if err == nil || err != nil && !strings.EqualFold(err.Error(), "timeout") {
                                     ^
server_test.go:4209:24: nilness: tautological condition: non-nil != nil (govet)
                if err == nil || err != nil && !strings.EqualFold(err.Error(), "timeout") {
                                     ^

@erikdubbelboer erikdubbelboer merged commit 9c3915b into valyala:master Mar 28, 2024
15 checks passed
@erikdubbelboer
Copy link
Collaborator

Thanks!

@alexandear alexandear deleted the test-nilness branch March 28, 2024 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants