mirror of
https://github.com/lima-vm/lima.git
synced 2026-10-28 11:44:35 +08:00
refactor: Use slices.Sort instead of sort.Strings
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
This commit is contained in:
4 files changed
+7
-6
No files matched your search
@@ -49,6 +49,8 @@ linters:
|
||||
msg: Do not use fmt.Print statements.
|
||||
- pattern: ^testing.T.Fatal.*$
|
||||
msg: Use assert functions from the gotest.tools/v3/assert package instead.
|
||||
- pattern: ^sort.*$
|
||||
msg: Use sorting functions from the slices package instead.
|
||||
analyze-types: true
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/cheggaaa/pb/v3/termutil"
|
||||
@@ -145,7 +145,7 @@ func listAction(cmd *cobra.Command, args []string) error {
|
||||
|
||||
if listFields {
|
||||
names := fieldNames()
|
||||
sort.Strings(names)
|
||||
slices.Sort(names)
|
||||
fmt.Fprintln(cmd.OutOrStdout(), strings.Join(names, "\n"))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -32,7 +32,7 @@ func Sudoers() (string, error) {
|
||||
}
|
||||
names = append(names, name)
|
||||
}
|
||||
sort.Strings(names)
|
||||
slices.Sort(names)
|
||||
|
||||
for _, name := range names {
|
||||
sb.WriteRune('\n')
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -162,7 +161,7 @@ func GetRandomFreeVSockPort(minPort, maxPort int) (int, error) {
|
||||
tree := make([]pair, 1, len(used)+1)
|
||||
tree[0] = pair{0, minPort}
|
||||
|
||||
sort.Ints(used)
|
||||
slices.Sort(used)
|
||||
for i, v := range used {
|
||||
if tree[len(tree)-1].v+tree[len(tree)-1].offset == v {
|
||||
tree[len(tree)-1].offset++
|
||||
|
||||
Reference in new issue
Block a user