Is there really a scenario in which you'd be ranging over the same map in two different goroutines at the same time while modifying it? Maps are not safe for concurrent modification, so the only way I could imagine that being safe would be something like:
goroutine 1:
for k, v := range myMap {
mtx.Lock()
mutate(myMap, k, v)
mtx.Unlock()
}
goroutine 2:
for k, v := range myMap {
mtx.Lock()
mutate(myMap, k, v)
mtx.Unlock()
}
Note that there are two subtle variations on this example. First, you could simply lock for the entire for loop, but then it wouldn't actually be concurrent access. Second, you could avoid mutations, and only do reads on the map, in which case having behavior under mutation be well-defined isn't necessary since there isn't any mutation happening in the first place.