Remove import

Proprietary

Remove an import statement from a Go compilation unit. Matches by import path, in any form (regular, aliased, dot, blank). Unless force is set, an import that the file still references is kept, as are blank (_) and dot (.) imports.

org.openrewrite.golang.RemoveImport

Required

The import path to remove.

Optional

forceBoolean

When true, remove the import even if the file still references the package, and remove blank (_) and dot (.) imports.

mod run . --recipe=org.openrewrite.golang.RemoveImport \ -P packagePath=fmt

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.