Radar · Go · Archive · Week 38 · Sep 15 – 21, 2025
maphash: drop purego version and establish stronger runtime boundary
Nice to knowstdlib
- What changed
- The proposal is to hand off maintenance of a reflection-based implementation of the
maphashpackage to the GopherJS project and drop thepuregoimplementation from std. - Production impact
- The source does not say.
- Try it
- Run
go test ./...to see that themaphashpackage no longer importsreflect. - Source
- github.com/golang/go/issues/74285
Understand it, then run it
The maphash package is used by Go to create hash values for map keys. In the past it had two versions: one that worked only on the standard Go runtime and another “purego” version that could run on other implementations like TinyGo or GopherJS. The purego version was slow and pulled in many other packages, making it hard for low‑level parts of the standard library to depend on maphash. The change removes that purego version and keeps only the runtime‑specific implementation, which is now the single source of truth for hashing map keys.
Run it now
// This program demonstrates the current maphash implementation.
// In Go 1.27.1 the purego version has been removed, so we use the
// runtime‑specific implementation directly. The program hashes a
// string and prints the resulting 64‑bit value.
package main
import (
"fmt"
"hash/maphash"
)
func main() {
var h maphash.Hash
h.WriteString("hello world")
fmt.Printf("hash: %x\n", h.Sum64())
}
What it printed when we ran it on Go 1.27.1
hash: 914c36ec41c4095d
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