Radar · Go · Archive · Week 39 · Sep 22 – 28, 2025
x/tools/go/analysis/passes/inline: publish //go:fix inline analyzer
Worth knowingtooling
- What changed
- The inline analyzer is moved to
x/tools/go/analysis/passes/inlineand can now be used bygo fix. - Production impact
- The source does not say.
- Try it
- Run
go fix -r inlineon a package that contains//go:fix inlinedirectives. - Source
- github.com/golang/go/issues/75267
Understand it, then run it
Run it now
// This program demonstrates a function annotated with //go:fix inline.
// In a Go 1.27.1 environment, running `go fix -fix=inline` would replace
// the call to add(2, 3) with the literal result 5, eliminating the function call.
package main
import "fmt"
//go:fix inline
func add(a, b int) int {
return a + b
}
func main() {
// The call below is a candidate for inlining by the inline analyzer.
result := add(2, 3)
fmt.Println(result) // prints 5
}
What it printed when we ran it on Go 1.27.1
5
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