Skip to content
masterclass Buddy

Go · Concept

Maps

The Go maps package contains generic helpers for comparing, copying, filtering, and iterating over maps. It also supports building maps from and inserting entries from iterators.

Last updated

Since
1.23.0 for All, Collect, Insert, Keys, and Values

Syntax

func Equal[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool
func Clone[M ~map[K]V, K comparable, V any](m M) M
func Copy[M1 ~map[K]V, M2 ~map[K]V, K comparable, V any](dst M1, src M2)
func EqualFunc[M1 ~map[K]V1, M2 ~map[K]V2, K comparable, V1, V2 any](m1 M1, m2 M2, eq func(V1, V2) bool) bool

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • All
  • Clone
  • Collect
  • Copy
  • DeleteFunc
  • Equal
  • EqualFunc
  • Insert

Source: maps package - maps - Go Packages. Checked 2026-11-03.