← All recipes
Moderne licensed

Migrate golang.org/x/exp/maps to maps

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

Migrate golang.org/x/exp/maps to the standard library. Clone, Copy, Equal, EqualFunc and DeleteFunc carry over unchanged; Clear(m) becomes the clear(m) builtin; and Keys(m) and Values(m), which return an iter.Seq in the standard library rather than a slice, are wrapped as slices.Collect(maps.Keys(m)). A file using Keys or Values needs Go 1.23, the rest Go 1.21.

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

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

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