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 22 · May 26 – Jun 1, 2025

cmd/fix: automate migrations for simple deprecations

Worth knowingtooling

What changed
The go fix subcommand can now automatically rewrite trivial API changes such as replacing a function call or constant with another.
Production impact
The source does not say.
Try it
Run go fix ./... on a module that contains a deprecated API to see if the tool updates the code.
Source
github.com/golang/go/issues/32816

Understand it, then run it

Run it now

Todaygo
// This program demonstrates the new go:fix directives.
// It will not compile until the change ships in a future Go release.
// The comments below describe how go:fix would rewrite the code.

package main

import "fmt"

// Deprecated: Use io.SeekStart instead.
//go:fix-to io.SeekStart
const SEEK_SET int = 0

func main() {
	// Before go:fix, this would use the old constant name.
	// After go:fix, the line below would be rewritten to use io.SeekStart.
	fmt.Println(SEEK_SET)
}

What it printed when we ran it on Go 1.27.1

0

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