This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 11 · Mar 9 – 15, 2026

Source‑level inliner in Go 1.26

Worth knowingruntime

What changed
The blog explains how Go 1.26’s source‑level inliner works and how it can help with self‑service API migrations.
Production impact
The source does not say.
Try it
Read the blog and experiment with the //go:fix directive on a small function to see the inlined code.
Source
go.dev/blog/inliner

Understand it, then run it

Go 1.26 introduces a new feature called the source‑level inliner. It lets a package author add a comment //go:fix inline to a function, type, or constant. When the go fix command is run, any call to that function is automatically replaced in the source code with the body of the function, or with a call to another function if the body simply forwards to it. This means that if a library deprecates a function and wants callers to switch to a new one, the library can add the comment and the migration happens automatically for anyone who runs go fix. The change does not alter the language syntax or runtime; it is a tooling improvement that makes refactoring safer and easier. You can try it by adding the comment to a function and then running go fix on a file that calls it.

Run it now

Todaygo
// This program demonstrates the source‑level inliner introduced in Go 1.26.
// It uses a deprecated function that forwards to a new implementation.
// Running `go fix` on this file will replace calls to OldReadFile with os.ReadFile.

package main

import (
	"fmt"
	"os"
)

// OldReadFile is a deprecated wrapper around os.ReadFile.
//go:fix inline
func OldReadFile(name string) ([]byte, error) {
	return os.ReadFile(name)
}

func main() {
	// The following call will be inlined by go fix.
	data, err := OldReadFile("example.txt")
	if err != nil {
		fmt.Println("error:", err)
		return
	}
	fmt.Println("content:", string(data))
}

What it printed when we ran it on Go 1.27.1

error: open example.txt: no such file or directory

Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed