← All recipes
Moderne licensed

Migrate golang.org/x/exp/constraints to cmp

Recipe IDorg.openrewrite.golang.migration.MigrateXExpConstraintsToStdlibArtifactgithub.com/moderneinc/recipes-go

Rewrite constraints.Ordered to cmp.Ordered, added to the standard library in Go 1.21. Integer, Float, Signed, Unsigned and Complex have no standard-library counterpart, so a file naming one of them keeps the x/exp import and is left for review.

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.migration.MigrateXExpConstraintsToStdlib

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

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