Migrate golang.org/x/exp/slog to log/slog
Recipe ID
org.openrewrite.golang.migration.MigrateXExpSlogToStdlibArtifactgithub.com/moderneinc/recipes-goRepoint golang.org/x/exp/slog at the standard library log/slog, added in Go 1.21, and rename the context-taking helpers the standard library spells differently: DebugCtx, InfoCtx, WarnCtx and ErrorCtx become DebugContext, InfoContext, WarnContext and ErrorContext. x/exp carries both spellings, so a file already on the Context ones is a plain path swap.
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.MigrateXExpSlogToStdlibIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go