Skip to content

impossible-integer-comparison

Default severity: warning

An integer type’s minimum and maximum values make some comparisons always true or false, such as checking whether an unsigned value is below zero or above its maximum. Target-sized int, uint, and uintptr use the loaded build architecture.

if value < 0 { use() } // value is unsigned
if value == 0 { use() }