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

Remove 'if err == nil' anti-pattern #652

Merged
merged 2 commits into from
May 22, 2023
Merged

Remove 'if err == nil' anti-pattern #652

merged 2 commits into from
May 22, 2023

Conversation

magiconair
Copy link
Member

Using 'if err == nil' is an anti-pattern in Go and should be avoided since most if not all Go developers expect 'if err != nil {...}'

This patch flips/removes the checks in the main client code but leaves the checks in the test cases were we require an error.

Using 'if err == nil' is an anti-pattern in Go and should be avoided
since most if not all Go developers expect 'if err != nil {...}'

This patch flips/removes the checks in the main client code but leaves
the checks in the test cases were we require an error.
@magiconair magiconair requested a review from kung-foo May 22, 2023 12:21
Copy link
Collaborator

@wmnsk wmnsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

client.go Outdated Show resolved Hide resolved
@magiconair magiconair merged commit 1bbf159 into main May 22, 2023
@magiconair magiconair deleted the drop-err-equals-nil branch May 22, 2023 13:10
@magiconair magiconair added this to the v0.3.14 milestone May 22, 2023
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