Iterating over a map in Go

Posted on May 17, 2022

Iterating over a map in Go is not predictable. This is a design decision to avoid relying on memory layout.

for k, v := range map {
    // always prints different results!
    fmt.Printf("%s: %s\n", k, v)
}