← All recipes
Moderne licensed

Migrate golang.org/x/exp to the standard library

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

Migrate golang.org/x/exp/slices, golang.org/x/exp/maps, golang.org/x/exp/constraints and golang.org/x/exp/slog to the slices, maps, cmp and log/slog packages that absorbed them, and drop the golang.org/x/exp requirement once nothing needs it. Each rewrite is gated on the module's go directive, and a file using API the standard library never took — the numeric constraints, or the pre-2023 boolean comparators — is left for review. Run go mod tidy afterwards to sync go.sum.

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

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

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