← All recipes
Moderne licensed

Tidy go.mod

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

Apply go mod tidy behavior to go.mod: add missing requirements at their resolved versions, remove unused ones, correct the // indirect markers, and sort require blocks. Adding and removing require the module graph resolved at parse time, and are no-ops without it. It does not sync go.sum; the RegenerateGoSum recipe covers that.

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

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

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