i forgor to commit sorry

This commit is contained in:
Sunglocto committed 2026-04-06 11:04:53 +01:00
1 parent 60d6a287e5
commit ce83000e0c
12 files changed
+327 -55

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
// Generic helpers
package main
import (
"sync"
"sort"
)
func rangeOrdered(m *sync.Map, fn func(k, v any) bool) {
var keys []string
m.Range(func(k, v any) bool {
keys = append(keys, k.(string))
return true
})
sort.Strings(keys)
for _, k := range keys {
v, _ := m.Load(k)
if !fn(k, v) {
break
}
}
}