maps

Core
import "maps"

Provides generic functions for map operations (Go 1.21+).

Example

package main

import (
    "fmt"
    "maps"
)

func main() {
    m := map[string]int{"a": 1, "b": 2}
    keys := maps.Keys(m)
    fmt.Println(keys)
    clone := maps.Clone(m)
    fmt.Println(clone)
}

Key Types & Functions

KeysValuesCloneEqualDeleteFuncCopy

About maps

The maps package (imported as maps) belongs to the Core category of Go packages. Provides generic functions for map operations (Go 1.21+).

Go's standard library is one of the language's greatest strengths, providing production-ready implementations for networking, cryptography, encoding, I/O, and more. The maps package follows Go's philosophy of simplicity and composability — small, focused packages that combine through interfaces like io.Reader and io.Writer.

When using maps in production, follow Go best practices: handle errors explicitly, use context for cancellation and timeouts, prefer composition over inheritance, and write table-driven tests. The Go documentation at pkg.go.dev provides comprehensive API references and examples for every exported type and function.

Related Packages