Rename package

Proprietary

Rename a Go package across a project — rewrites the package declaration in files that own the package, and rewrites import paths in every file that references it.

org.openrewrite.golang.RenamePackage

Required

The fully qualified package path to rename.

The fully qualified package path to use instead.

mod run . --recipe=org.openrewrite.golang.RenamePackage \ -P oldPackagePath=github.com/old/foo \ -P newPackagePath=github.com/new/foo

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