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 28 · Jul 6 – 12, 2026

maps: add Same func

Nice to knowstdlib

What changed
The maps package now has a Same generic function that reports whether two maps refer to the same underlying data structure.
Production impact
The source does not say.
Try it
Use maps.Same(m1, m2) to compare map identities.
Source
github.com/golang/go/issues/78456

Understand it, then run it

After the change ships

go · the proposal's code; it does not compile until the change ships

// This does not compile until the Same function is shipped in Go 1.28.
package main

import (
	"fmt"
	"maps"
)

func main() {
	s := map[int]struct{}{1: {}, 2: {}}
	t := s
	u := map[int]struct{}{1: {}, 2: {}}

	fmt.Println(maps.Same(s, t)) // true
	fmt.Println(maps.Same(s, u)) // false
}

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed