Compile regex outside loop

Proprietary

Find regexp.Compile() or regexp.MustCompile() calls inside for/range loops. Compile the regex once outside the loop for better performance.

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

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