← All recipes
Moderne licensed

Remove empty functions

Recipe IDorg.openrewrite.golang.codequality.RemoveEmptyFunctionArtifactgithub.com/moderneinc/recipes-go

Remove unexported free functions with empty bodies and no return type. main in package main and init are preserved because the runtime invokes them rather than other code. Methods with receivers are preserved because they may implement an interface. Exported functions are preserved because removing one breaks importers.

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.codequality.RemoveEmptyFunction

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

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