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:
committed by
GitHub
parent
9e4c283370
commit
147df5c971
@@ -10,7 +10,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -34,7 +34,7 @@ func hashTemplateFilesAndTestName(t *testing.T, testName string, templateFiles m
|
||||
for fileName := range templateFiles {
|
||||
sortedFileNames = append(sortedFileNames, fileName)
|
||||
}
|
||||
sort.Strings(sortedFileNames)
|
||||
slices.Sort(sortedFileNames)
|
||||
|
||||
// Inserting a delimiter between the file name and the file content
|
||||
// ensures that a file named `ab` with content `cd`
|
||||
|
||||
Reference in New Issue
Block a user