Radar · Go · #003 · Week 41 · Oct 5 – 11, 2026
Deprecate go/build.ArchChar(..)
Worth knowingstdlib
- What changed
- The proposal to mark go/build.ArchChar as deprecated was accepted.
- Production impact
- The source does not say.
- Try it
- Compile a program that calls build.ArchChar and observe the deprecation warning.
- Source
- github.com/golang/go/issues/75129
Understand it, then run it
go/build.ArchChar used to return a character that identified the CPU architecture. Since Go 1.5 the function always returns an error, and the proposal accepted in October 2026 marks it as deprecated. New code should not call it because it never gives useful information.
When you write Go programs you normally import go/build to inspect build constraints. The deprecated function is still present in the package, but the compiler will emit a deprecation warning and the function will still return an error.
The change means you can stop worrying about handling a special return value from ArchChar. Just avoid the call entirely and use other ways to detect the architecture, such as runtime.GOARCH.
Run it now
package main
import (
"fmt"
"go/build"
)
func main() {
// ArchChar requires an architecture name argument.
// Since Go 1.5 it always returns an error, demonstrating the deprecation.
ch, err := build.ArchChar("amd64")
if err != nil {
fmt.Println("ArchChar error:", err)
return
}
fmt.Printf("ArchChar returned: %c\n", ch)
}
What it printed when we ran it on Go 1.27.1
ArchChar error: architecture letter no longer used
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-120b from the linked source · claims checked against the sources · human-reviewed