> For example, is this program guaranteed to print "1 1"?
> https://go.dev/play/p/PeBEXKp1deH
Yes, because the range iteration loop does not add/delete any items.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group an
None of the conditions specified in that clause applies for updating key
in-place. The way I read it, a new entry is not added, so the iteration
should visit every entry only once. Thus, the program always prints "1 1".
On Tue, Aug 2, 2022 at 9:20 PM Kevin Chowski wrote:
> Hello Go gurus,
>
> I
Hello Go gurus,
I think there is some ambiguity in the language spec about what happens
when a map entry is updated during iteration. Quoting the spec
(https://go.dev/ref/spec#For_range):
3. The iteration order over maps is not specified and is not guaranteed to
be the same from one iteration