Add import
ProprietaryAdd an import statement to a Go compilation unit. No-op if the import is already present in a compatible form.
org. openrewrite. golang. AddImportRequired
The import path to add.
Optional
onlyIfReferencedBoolean
When true, add the import only if some identifier in the file already references the package via type attribution.
mod run . --recipe= org. openrewrite. golang. AddImport \
-P packagePath= fmtInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.