You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and even surprised some people who have been writing Go for years, when pointing out that thanks to zero values the above is totally superfluous, and that the following is totally sufficient. (Or at least I can't think of a type where it is not.)
found[x] +=y
Note that I think = 1 and ++ should be detected, but presumably as a special case, unless ++ desugars to += 1.
What did you expect to see?
A warning from go vet that the pattern should be corrected.
What did you see instead?
Nothing
The text was updated successfully, but these errors were encountered:
This probably belongs in a style checker like lint, or something by @dominikh, because vet is focused solely on correctness. While superfluous, the code will function correctly. Given that, I’m going to close this issue; thanks for floating the idea.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.10
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/ZU-Ys77Q766
Basically, I have run into many variations of:
and even surprised some people who have been writing Go for years, when pointing out that thanks to zero values the above is totally superfluous, and that the following is totally sufficient. (Or at least I can't think of a type where it is not.)
Note that I think
= 1
and++
should be detected, but presumably as a special case, unless++
desugars to+= 1
.What did you expect to see?
A warning from
go vet
that the pattern should be corrected.What did you see instead?
Nothing
The text was updated successfully, but these errors were encountered: