Go 1.26's Modernized go fix: Automate Small Migrations, Review Every Patch
Go 1.26 rewrote go fix around the same analysis framework used by go vet and added a suite of modernizers. Instead of relying only on old, narrow source transformations, the tool can suggest mechanical changes that adopt newer language and standard-library idioms. It also supports project-specific inlining through directives.
Treat the tool as a patch generator. Run it on a clean branch, inspect the diff, and group changes by analyzer or package so reviewers can understand intent. Run formatting, static analysis, unit tests, and integration tests after each group. A safe mechanical edit should preserve behavior, but repository-specific conventions and edge cases still deserve review.
This can make large codebase maintenance less tedious. A team can upgrade its minimum Go version, apply one class of modernization, then review the resulting code separately from unrelated refactoring. Keep the module’s Go version intentional; some modern syntax or library APIs require a higher baseline.
The command is especially useful when maintainers understand the target idiom but do not want to hand-edit hundreds of repetitive call sites. It is less useful when the project cannot adopt the newer minimum Go version or when the suggested change obscures domain-specific behavior.
The Go 1.26 release notes describe the rewritten tool and its modernizers. The Go team’s release announcement also highlights the language and runtime changes in the same release.