Use range to iterate over a map:
ages := map[string]int{"Alice": 30, "Bob": 25}
for name, age := range ages {
fmt.Printf("%s is %d\n", name, age)
}
The iteration order is random. Don't depend on entries coming out in any particular order. If you need sorted output, collect keys into a slice and sort it first.