Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -31,16 +31,21 @@ func ParseScopeString(s string) []string {
if len(fields) == 0 {
return []string{}
}
seen := make(map[string]struct{}, len(fields))
out := make([]string, 0, len(fields))
for _, f := range fields {
if _, ok := seen[f]; ok {
continue
}
seen[f] = struct{}{}
out = append(out, f)
}
sort.Strings(out)
return out
}
@@ -50,9 +55,11 @@ func FormatScopeString(scopes []string) string {
if len(scopes) == 0 {
return ""
}
sorted := make([]string, len(scopes))
copy(sorted, scopes)
sort.Strings(sorted)
return strings.Join(sorted, " ")
}
@@ -61,18 +68,23 @@ func FormatScopeString(scopes []string) string {
// result is a fresh slice and never aliases any input.
func UnionScopes(scopeSets ...[]string) []string {
seen := map[string]struct{}{}
for _, set := range scopeSets {
for _, s := range set {
if s == "" {
continue
}
seen[s] = struct{}{}
}
}
out := make([]string, 0, len(seen))
for s := range seen {
out = append(out, s)
}
sort.Strings(out)
return out
}