← All recipes
Moderne licensed

Swap mitchellh/mapstructure imports to go-viper/mapstructure/v2

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

Repoint every github.com/mitchellh/mapstructure import at github.com/go-viper/mapstructure/v2, the maintained fork. The package name is unchanged, so call sites stay as written; only the import path and its type attribution move. A file naming mapstructure.Error, the one export v2 dropped, is left alone — see FindMapstructureErrorUsage.

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

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

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