← All recipes
Moderne licensed

Replace extra %w verbs with %v in fmt.Errorf

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

Replace all but the first %w with %v in fmt.Errorf format strings. Multiple error wrapping is invalid in Go < 1.20 and rare in later versions.

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

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

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