Server Virtualization

2026-05-02 17:51:40

Go 1.26 Launches Source-Level Inliner in Revamped `go fix` for Seamless API Migrations

Go 1.26's new go fix introduces source-level inlining for self-service API migrations, enabling package authors to automate code updates safely.

Breaking: Go 1.26 Introduces Self-Service Modernization with Source-Level Inlining

10 March 2026 — The Go team has unveiled a completely overhauled go fix command in Go 1.26, featuring a groundbreaking source-level inliner that allows package authors to create custom, automated API migrations. This tool, built on a 2023 algorithm, transforms function calls directly in source code, enabling developers to modernize their codebases safely and efficiently.

Go 1.26 Launches Source-Level Inliner in Revamped `go fix` for Seamless API Migrations
Source: blog.golang.org

“The source-level inliner is the first fruit of our efforts to provide self-service modernizers and analyzers,” said Alan Donovan, Go contributor and author of the new feature. “It enables any package author to express simple API migrations and updates in a straightforward and safe way.”

What Is Source-Level Inlining?

Source-level inlining replaces a function call with the body of the called function, substituting actual arguments for parameters. Unlike compiler-level inlining, which works on ephemeral intermediate representations, this transformation durably modifies the source code, making it visible in the codebase.

“If you’ve ever used gopls’ ‘Inline call’ refactoring in VS Code, you’ve already experienced it,” Donovan explained. “Now this same inliner powers the new go fix command.”

Background

Go has historically relied on bespoke modernizers for each new language or library feature, making updates labor-intensive. The go fix command, introduced early in Go’s history, provided automated fixes but required manual maintenance for each change.

In 2023, the Go team developed a robust algorithm for source-level inlining of function calls. This algorithm was initially used interactively in gopls for refactorings like “Change signature” and “Remove unused parameter,” handling subtle correctness issues automatically.

Go 1.26 Launches Source-Level Inliner in Revamped `go fix` for Seamless API Migrations
Source: blog.golang.org

Now, in Go 1.26, that same inliner is integrated into go fix, enabling any package to define its own migration rules. This marks a shift from tightly coupled modernizers to a flexible, self-service model.

What This Means

For the Go ecosystem, the source-level inliner democratizes API migration. Package authors can now create automated upgrade paths for their own libraries, reducing friction for users. For example, when a function signature changes, the inliner can rewrite call sites without breaking existing code.

“It’s a crucial building block for source transformation tools,” Donovan noted. “We expect it to accelerate adoption of new APIs and best practices across the community.” Development teams can adopt Go 1.26 and start using the new go fix immediately, with existing modernizers already included.

How to Get Started

To try the new go fix with source-level inlining, upgrade to Go 1.26 and run go fix ./... in your project. The command will apply built-in modernizers, including those for language changes. Package authors can define custom migrations using the inliner’s configuration.

Detailed documentation is available in the Go 1.26 release notes. For a deeper dive into the inliner algorithm, see the original blog post on //go:fix inline and the source-level inliner.