==================
WARNING: DATA RACE
Read at 0x00c00015a5a0 by goroutine 25:
ruderich.org/simon/safcm/cmd/safcm/config.ResolveHostGroups.func1()
cmd/safcm/config/groups.go:130 +0x1c7
ruderich.org/simon/safcm/cmd/safcm/config.ResolveHostGroups()
cmd/safcm/config/groups.go:154 +0x521
[...]
Previous write at 0x00c00015a5a0 by goroutine 21:
slices.insertionSortOrdered[go.shape.string]()
/usr/lib/go-1.24/src/slices/zsortordered.go:15 +0x2f9
slices.pdqsortOrdered[go.shape.string]()
/usr/lib/go-1.24/src/slices/zsortordered.go:75 +0x6c4
slices.Sort[go.shape.[]string,go.shape.string]()
/usr/lib/go-1.24/src/slices/sort.go:18 +0xd6
ruderich.org/simon/safcm/cmd/safcm/config.(*templateArgs).GroupHosts()
cmd/safcm/config/templates.go:116 +0x97
[...]
"fmt"
"os"
"regexp"
+ "slices"
"sort"
"strings"
}
return nil, fmt.Errorf("%s member %q not found", errPrefix, x)
}
+
+ // Keep sorted for templates
+ slices.Sort(groups[name])
}
// Sanity check for global configuration
hosts,
map[string][]string{
"group": {
- "detected_linux",
"detected_freebsd",
+ "detected_linux",
"host1.example.org",
},
"group:remove": {
- "host2",
"detected_mips",
+ "host2",
},
"group2": {
"all",
"all",
},
"all_except_some:remove": {
- "host1.example.org",
"group2",
+ "host1.example.org",
},
"remove": {
"host1.example.org",
"fmt"
"os"
"path/filepath"
- "slices"
"strings"
"text/template"
func (t *templateArgs) GroupHosts(group string) []string {
t.groupMustExist(group)
- x := t.allGroupHosts[group]
- slices.Sort(x)
- return x
+ return t.allGroupHosts[group]
}
func (t *templateArgs) groupMustExist(group string) {