Skip to content

Commit 8eba22e

Browse files
committed
switch from manual map clone to maps.Clone
1 parent 9a205b2 commit 8eba22e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

dispatch/dispatch.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"errors"
1919
"fmt"
2020
"log/slog"
21+
"maps"
2122
"sort"
2223
"sync"
2324
"time"
@@ -240,11 +241,7 @@ func (d *Dispatcher) Groups(routeFilter func(*Route) bool, alertFilter func(*typ
240241
// have a mutex protecting their internal state.
241242
// The aggrGroup methods use the internal lock. It is important to avoid
242243
// accessing internal fields on the aggrGroup objects.
243-
copiedMap := map[model.Fingerprint]*aggrGroup{}
244-
for fp, ag := range ags {
245-
copiedMap[fp] = ag
246-
}
247-
aggrGroupsPerRoute[route] = copiedMap
244+
aggrGroupsPerRoute[route] = maps.Clone(ags)
248245
}
249246
d.mtx.RUnlock()
250247

0 commit comments

Comments
 (0)