maps
5 articles
-
Represent and transform data safely
Remove Duplicate Values from a Go Slice Without Losing First-Seen Order
Use a map-backed pass to keep the first occurrence of each comparable value, an equality function for other values, or sorting and compacting when order can change.
-
Represent and transform data safely
How to Merge Two Maps in Go
Merge Go maps with a loop or maps.Copy, choose whether to mutate an input, and understand when generics or mergo better fit the job.
-
Represent and transform data safely
How to Use Sets in Go with mapset and Map-Based Sets
Use map[T]struct{} for lightweight membership checks, or mapset v2 when you need typed set operations and a concurrency-oriented implementation.
-
Represent and transform data safely
How to Clone a Map in Go Without Sharing the Underlying Values
Learn when maps.Clone is enough, why reference-valued entries still alias, and how to write a true deep copy for maps containing slices.
-
Represent and transform data safely
Using Maps in Go: Declarations, Lookups, and Iteration
Learn how to initialize Go maps, distinguish missing keys from zero values, delete entries, and iterate without relying on order.





