Avoid lock in loop
Recipe ID
org.openrewrite.golang.codequality.AvoidLockInLoopArtifactgithub.com/moderneinc/recipes-goFind Lock() or RLock() calls inside for/range loops. Acquiring locks in tight loops can cause contention; consider locking once outside the loop.
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.AvoidLockInLoopIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go