Allocate outside loop

Proprietary

Find new() calls inside for/range loops. Repeated heap allocations in loops add GC pressure; consider reusing the object.

org.openrewrite.golang.codequality.AllocateOutsideLoop
mod run . --recipe=org.openrewrite.golang.codequality.AllocateOutsideLoop

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.