Do not divide by 0
Integer division by zero results in a panic. This includes both division expressions [FLS-DIVISION-EXPR] and remainder expressions [FLS-REMAINDER-EXPR]. Division and remainder expressions on signed integers are also susceptible to arithmetic overflow. Overflow is covered in full by the guideline Ensure that integer operations do not result in arithmetic overflow. This rule applies to the following primitive integer types [FLS-INTEGER-TYPES]:
This rule does not apply to evaluation of the This rule is a less strict version of Do not use an integer type as a divisor during integer division. All code that complies with that rule also complies with this rule.
|