Open file outside loop

Proprietary

Find os.Open() or os.Create() calls inside for/range loops. Opening files in tight loops should use a single open outside the loop.

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

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