Adopt testify assert.Nil
Recipe ID
org.openrewrite.golang.testify.AdoptTestifyAssertNilArtifactgithub.com/moderneinc/recipes-goReplace if x != nil { t.Error(...) } with assert.Nil(t, x) and if x == nil { t.Error(...) } with assert.NotNil(t, x) from github.com/stretchr/testify/assert, for non-error operands. Error operands are handled by the NoError / Error recipes.
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.AdoptTestifyAssertNilIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go