mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: replace sort.Strings with slices.Sort (#23457)
The slices package provides type-safe generic replacements for the old typed sort convenience functions. The codebase already uses slices.Sort in 43 call sites; this finishes the migration for the remaining 29. - sort.Strings(x) -> slices.Sort(x) - sort.Float64s(x) -> slices.Sort(x) - sort.StringsAreSorted(x) -> slices.IsSorted(x)
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/mail"
|
||||
"sort"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -1589,7 +1589,7 @@ func claimFields(claims map[string]interface{}) []string {
|
||||
for field := range claims {
|
||||
fields = append(fields, field)
|
||||
}
|
||||
sort.Strings(fields)
|
||||
slices.Sort(fields)
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1602,7 +1602,7 @@ func blankFields(claims map[string]interface{}) []string {
|
||||
fields = append(fields, field)
|
||||
}
|
||||
}
|
||||
sort.Strings(fields)
|
||||
slices.Sort(fields)
|
||||
return fields
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user