Go

Go

Made by DeepSource

Non-idiomatic slice zeroing for loop GO-P4001

Performance
Critical
Autofix

Using non-idiomatic slice zeroing might not get recognized by the compiler for further optimizations. Using the idiomatic slice zeroing method is recommended so the compiler can optimize it during compilation.

Bad practice

for i := 0; i < len(b); i++ { b[i] = 0 }

Recommended

for i := range b { b[i] = 0 }