Iterate over a Go map using the range keyword to access keys and values in a single loop.
Use the range keyword on a map to iterate over its key-value pairs, where the first variable holds the key and the second holds the value.
m := map[string]int{"a": 1, "b": 2}
for k, v := range m {
fmt.Println(k, v)
}
If you only need the keys, use a blank identifier (_) for the value; if you only need the values, use it for the key.
The range keyword lets you loop through every item in a map one by one. It automatically gives you the label (key) and the content (value) for each entry so you can process them. Think of it like going down a list of names and reading the phone number next to each one.