//go:fix inline and the source-level inliner

2026/04/07

The latest version of Go, 1.26, introduces a new implementation of the go fix subcommand, aimed at helping developers keep their Go code modern and up-to-date. A key component of this subcommand is the source-level inliner, a powerful tool that enables package authors to simplify API migrations and updates. By using the source-level inliner, developers can easily rename functions, fix design flaws in their APIs, and migrate types and constants. This tool works by replacing a function call with a copy of the called function's body, substituting arguments for parameters. To utilize the inliner, developers need to annotate the old function with a //go:fix inline comment and then run the go fix command on a file containing a call to that function. The inliner will then replace the call, effectively updating the code. With its ability to safely and efficiently update code, the source-level inliner has already been used to prepare over 18,000 changelists in Google's massive monorepo. For more information on how to use the source-level inliner and its benefits, refer to the official release notes.

References