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
CheckIncDec flags x += 1 and recommends using x++ instead. The check exists, but isn't made available, not even as an optional check. We haven't enabled it so far because it can produce unhelpful warnings for code like the following:
x += 3
...
x += 2
...
x += 1
Either enable the check (optionally with some improvements) or remove it.
The text was updated successfully, but these errors were encountered:
Either enable the check (optionally with some improvements) or remove it.
I'd say: remove it.
Using x++ (but, alas, not ++x) in Go is a bit confusing in the beginning if you've worked with ++x and --x in other languages before because it's a statement in Go instead of an expression as in other languages (not to mention the difference between ++x and x++ and what version Go actually compiles to). So you have to re-learn its use anyway in Go and probably end up with x += 1 so that recommending the use x++ wouldn't actually help.
Hence leave it to the programmer and don't interfere with a linter recommendation.
CheckIncDec flags
x += 1
and recommends usingx++
instead. The check exists, but isn't made available, not even as an optional check. We haven't enabled it so far because it can produce unhelpful warnings for code like the following:Either enable the check (optionally with some improvements) or remove it.
The text was updated successfully, but these errors were encountered: