No, this is not correct.
If you put a new entry in the map during iterating the same map, it will be added, though it is not guaranteed that the new element will be iterated over.
You can inspect your map after the loop, all your elements, even the non-iterated will be there.
You can assume that go does roughly the following when iterating over a map, at least semantically:
- Get a list of keys
- Randomize its order
- While iterating keep an index at where in this list we are now
When you then add an entry to the map, it will also create a corresponding entry in the list of keys, but it will put that at a random position in the list and bump the current position if the entry was added to the left (to avoid double iteration of a key) or leave the index as is when inserted at a higher position.
If the new key was inserted at a higher position, we will encounter it during iteration, if it was added at a lower position, we will not see it.