March 15, 2026
Inline and Sinker!
//go:fix inline and the source-level inliner
Go's new auto-rewriter sparks cheers, side-eye, and a full-on comment brawl
TLDR: Go 1.26 adds a tool that auto-updates code by rewriting old function calls to new ones via a comment directive. Developers are split: some love the painless upgrades, others fear risky rewrites, say it mainly fits big monorepos, and grumble that using comments instead of real syntax feels hacky.
Go just dropped a power tool: a source-level “inliner” in Go 1.26 that lets library authors tag old functions so the go fix command can auto-rewrite your code to call the new stuff. Think: change every “old button” to the “new button” across millions of files with one sweep. The demo? Replacing the old ioutil.ReadFile with the newer os.ReadFile—clean, safe, and automatic.
But the comments? Whew. Skeptics arrived fast. One user waved a scary code snippet showing how crash-handling could be “rewritten badly” if the tool inlines the wrong thing at the wrong time, and begged the blog to call this out. Another stepped in with the calm explainer: this isn’t compiler magic, it’s a source rewrite you run on your code—great in big companies that can fix everything at once, less perfect for the messy real world. Meanwhile, the style police groaned: why use comment directives like //go:fix inline instead of proper language syntax? “Kludge,” one sighed, dropping HotComments like a mic. A drive-by Hygienic macro link stirred the “just use macros” crowd, and someone wished, “Can we get this in Python, please?”
The vibe: hyped, nervous, and hilariously opinionated—classic Go drama.
Key Points
- •Go 1.26 introduces a new implementation of the go fix subcommand featuring a source-level inliner.
- •The source-level inliner, built in 2023, replaces function calls with function bodies in source code, unlike compiler inlining on IR.
- •gopls uses the inliner for refactorings such as 'Inline call', 'Change signature', and 'Remove unused parameter'.
- •go fix leverages a //go:fix inline directive to automatically inline calls for safe, self-service API migrations.
- •An example shows migrating from deprecated ioutil.ReadFile to os.ReadFile, with go fix updating imports and call sites while preserving behavior.