← All recipes
Moderne licensed

Adopt stretchr/testify

Recipe IDorg.openrewrite.golang.testify.AdoptTestifyArtifactgithub.com/moderneinc/recipes-go

Migrate hand-written test assertions to the github.com/stretchr/testify library and add the dependency to go.mod. Converts error guards to require/assert NoError/Error, length checks to Len, equality checks to Equal/NotEqual, nil checks to Nil/NotNil, and boolean checks to True/False, then adds the testify require. Does not sync go.sum; a go mod tidy is still needed to complete resolution.

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.testify.AdoptTestify

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

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