Avoid fmt in loop
Recipe ID
org.openrewrite.golang.codequality.AvoidFmtInLoopArtifactgithub.com/moderneinc/recipes-goFind fmt.Sprintf, fmt.Sprint, or fmt.Fprintf calls inside for/range loops. These allocate on every call; prefer direct string operations or strconv.
Single recipeProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.golang.codequality.AvoidFmtInLoopIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go