Skip to content

duration-multiplied-by-duration

Default severity: warning

time.Duration is a scalar count of nanoseconds. Multiplying two duration values produces squared time units, which is almost never meaningful. This often happens when a value that was expected to be a unitless count has already been converted to a duration.

delay := duration * time.Second
delay := time.Duration(count) * time.Second