Simplify redundant len check before range
Recipe ID
org.openrewrite.golang.codequality.SimplifyRedundantLenBeforeRangeArtifactgithub.com/moderneinc/recipes-goRemove if len(s) > 0 { for ... range s } where the len check is redundant because range over nil/empty produces zero iterations.
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.SimplifyRedundantLenBeforeRangeIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go