Change-Id: I874f0c0399cb09de4fe4dd2097602c5fa0512b12
GitHub-Last-Rev:
73be01ae2a27adf0b7629a198057674018b5d392
GitHub-Pull-Request: golang/go#67223
Reviewed-on: https://go-review.googlesource.com/c/go/+/583735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
"os"
"reflect"
"runtime"
- "sort"
+ "slices"
"strconv"
"strings"
"time"
result[i] = f
i++
}
- sort.Slice(result, func(i, j int) bool {
- return result[i].Name < result[j].Name
+ slices.SortFunc(result, func(a, b *Flag) int {
+ return strings.Compare(a.Name, b.Name)
})
return result
}
"os/exec"
"regexp"
"runtime"
- "sort"
+ "slices"
"strconv"
"strings"
"testing"
// Now test they're visited in sort order.
var flagNames []string
Visit(func(f *Flag) { flagNames = append(flagNames, f.Name) })
- if !sort.StringsAreSorted(flagNames) {
+ if !slices.IsSorted(flagNames) {
t.Errorf("flag names not sorted: %v", flagNames)
}
}