// the find
rsc/rf
A refactoring tool for Go
rf is an experimental command-line refactoring tool for Go, built by Russ Cox, that supports package-aware moves, renames, inlining, and example-based pattern rewrites across a Go module. It's aimed at Go maintainers doing large mechanical refactors who are comfortable reviewing a diff rather than trusting a black box.
The refactor/ package cleanly separates the rewrite engine (addr resolution, import management, package graph, syntax editing, snapshotting) from the individual commands, so mv, rm, inline, and inject are thin wrappers over a real engine rather than one big script. The testdata/ directory has well over 100 golden-file cases covering gnarly corners of Go semantics specifically: generics, pointer receivers, type aliases, struct tags, cross-package moves, import cycles, and method-to-func conversions, which is the kind of test coverage you want from a tool that rewrites your source tree. The ex.go/match.go/key.go trio implements example-based rewriting (show a before/after snippet, it finds and applies the pattern elsewhere), a more general version of the author's own eg tool.
The README is a single paragraph whose entire content is a warning that the tool is rough, buggy, and will change incompatibly — there's no usage documentation, no command reference, and no examples of invoking mv/rm/inline/inject from the CLI. It's a personal project from a Go core contributor, not an official Go tool, so it isn't wired into gopls, goimports, or go tool, and there's no indication of ongoing community maintenance beyond the author's own commits. At 693 stars and 29 forks with an explicit "will break you" disclaimer, anyone adopting it for a real refactor is on their own if something goes sideways on a large codebase, and the lack of semantic versioning or releases means there's no stable point to depend on.