Radar · Go · Archive · Week 30 · Jul 20 – 26, 2026
Blanket approval for String and GoString methods
Worth knowingstdlib
- What changed
- The Go team has decided that adding a
StringorGoStringmethod to an existing type no longer requires the full proposal review process; it only needs normal code‑review scrutiny. - Production impact
- The source does not say.
- Try it
- Add a
Stringmethod to a custom type and verify that the change compiles without a proposal. - Source
- github.com/golang/go/issues/80024
Understand it, then run it
The Go team has decided that adding a String or GoString method to an existing type no longer requires a full proposal review. Before this change, any new method on a type had to go through a committee review that could take weeks. Now, if you simply add a method that returns a human‑readable string for debugging, you only need normal code review. This makes it easier to give types useful string representations without a long approval process.
Run it now
// This program demonstrates adding a String method to an existing type.
// The change is already in Go 1.27.1, so it compiles and runs as is.
package main
import (
"fmt"
)
type Thing struct {
Name string
Age int
}
// String returns a human‑readable representation of Thing suitable for debugging.
func (t Thing) String() string {
return fmt.Sprintf("Thing{Name:%q, Age:%d}", t.Name, t.Age)
}
func main() {
t := Thing{Name: "Gopher", Age: 3}
// fmt.Println uses the String method automatically.
fmt.Println(t)
}
What it printed when we ran it on Go 1.27.1
Thing{Name:"Gopher", Age:3}
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