Remove unused go.mod requirements
Recipe ID
org.openrewrite.golang.migration.RemoveUnusedGoModRequiresArtifactgithub.com/moderneinc/recipes-goRemove require directives whose module provides no imported package and is unreachable through the module graph from any module that does. Uses the package→module map and module graph resolved at parse time; a no-op when that resolution did not run. Modules that pin a transitive version are kept, so the removal is build-safe.
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.RemoveUnusedGoModRequiresIf the recipe isn’t available locally, install it with:
mod config recipes go install github.com/moderneinc/recipes-go