Skip to content

negative-length-capacity-comparison

Default severity: warning

The predeclared len and cap functions always return non-negative values, so testing whether either result is below zero can never succeed.

if len(values) < 0 { unreachable() }
if len(values) == 0 { handleEmpty() }