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
should use 'return len(t) <= 0' instead of 'if len(t) > 0 { return false }; return true' (S1008)
Most Go developers would write len(t) == 0 instead of len(t) <= 0, since we know that builtins like len or cap cannot return negative values. Staticcheck should know the same.
The text was updated successfully, but these errors were encountered:
Rather than "len(x) <= 0", which is technically correct,
but not actually what most Go programmers would write,
since funcs like len or cap can never return negative integers.
Do the same for cap and copy, which never return negative ints either.
Fixesdominikh#1422.
Rather than "len(x) <= 0", which is technically correct,
but not actually what most Go programmers would write,
since funcs like len or cap can never return negative integers.
Do the same for cap and copy, which never return negative ints either.
Fixes#1422.
As discussed in Slack, I got a suggestion like:
Most Go developers would write
len(t) == 0
instead oflen(t) <= 0
, since we know that builtins likelen
orcap
cannot return negative values. Staticcheck should know the same.The text was updated successfully, but these errors were encountered: