Skip to content

Commit

Permalink
fix initer state
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed Feb 26, 2024
1 parent e187f1f commit 4659710
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion maps/ordered_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func (o *OrderedMap[k, v]) Get(key k) (v, bool) {
// Iterate iterates over the OrderedMap in insertion order
func (o *OrderedMap[k, v]) Iterate(f func(key k, value v) bool) {
o.inIter = true
defer func() {
o.inIter = false
}()
for _, key := range o.keys {
// silently discard any missing keys from the map
if _, ok := o.m[key]; !ok {
Expand All @@ -65,7 +68,6 @@ func (o *OrderedMap[k, v]) Iterate(f func(key k, value v) bool) {
}
o.keys = tmp
o.dirty = false
o.inIter = false
}
}

Expand Down

0 comments on commit 4659710

Please sign in to comment.