-
-
Notifications
You must be signed in to change notification settings - Fork 379
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
No check for unnecessary nil
check on a map followed by a len
check of the same map
#1527
Labels
Comments
dominikh
added
enhancement
and removed
needs-triage
Newly filed issue that needs triage
labels
Apr 24, 2024
arp242
added a commit
to arp242/go-tools
that referenced
this issue
May 26, 2024
Also clarify the docs that this also checks maps and channels. Fixes dominikh#1527
arp242
added a commit
to arp242/go-tools
that referenced
this issue
May 26, 2024
Also clarify the docs that this also checks maps and channels. Fixes dominikh#1527
arp242
added a commit
to arp242/go-tools
that referenced
this issue
May 26, 2024
Also clarify the docs that this also checks maps and channels. Fixes dominikh#1527
It does, what doesn't work is using a selector like |
arp242
added a commit
to arp242/go-tools
that referenced
this issue
Jun 1, 2024
Also clarify the docs that this also checks maps and channels. Fixes dominikh#1527
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Considering staticcheck identifies unnecessary nil checks for slices followed by a
len
check, I am surprised it doesn’t seem to do the same for maps.I was just reviewing some code that is essentially:
I was expecting staticcheck to flag the o.m != nil part as unnecessary, but it isn’t.
The text was updated successfully, but these errors were encountered: