← All recipes
Moderne licensed

Find unused go.mod requirements

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

Find direct require directives in go.mod that no package in the module imports. A direct requirement is only justified by a direct import, so these are candidates go mod tidy would remove or demote to // indirect. They are reported rather than removed because deciding whether a module is still needed transitively requires the module graph, which is not available offline.

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

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

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