Prefer %w over %s in fmt.Errorf for error wrapping
Recipe ID
org.openrewrite.golang.codequality.PreferErrorfWrapVerbArtifactgithub.com/moderneinc/recipes-goReplace %s with %w in fmt.Errorf format strings when the corresponding argument is an error, to preserve the error chain.
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.PreferErrorfWrapVerbIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go