← All recipes
Moderne licensed

Avoid channel length check

Recipe IDorg.openrewrite.golang.codequality.AvoidChannelLenCheckArtifactgithub.com/moderneinc/recipes-go

Find comparisons on channel length such as len(ch) == 0. These are almost always racy because the length can change between the check and the next operation.

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.AvoidChannelLenCheck

If the recipe isn’t available locally, install it with:

mod config recipes go install github.com/moderneinc/recipes-go