mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
all: run go fix -slicessort
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
@@ -348,9 +349,7 @@ func (tg *testGroup) test(evalInterval time.Duration, groupOrderMap map[string]i
|
||||
for k := range alertEvalTimesMap {
|
||||
alertEvalTimes = append(alertEvalTimes, k)
|
||||
}
|
||||
sort.Slice(alertEvalTimes, func(i, j int) bool {
|
||||
return alertEvalTimes[i] < alertEvalTimes[j]
|
||||
})
|
||||
slices.Sort(alertEvalTimes)
|
||||
|
||||
// sort group eval order according to the given "group_eval_order".
|
||||
sort.Slice(testGroups, func(i, j int) bool {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -66,9 +66,7 @@ func (l Labels) AsExtraLabels() []string {
|
||||
res = append(res, k+"="+v)
|
||||
}
|
||||
// sort for consistent uri.
|
||||
sort.Slice(res, func(i, j int) bool {
|
||||
return res[i] < res[j]
|
||||
})
|
||||
slices.Sort(res)
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"slices"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@@ -196,9 +196,7 @@ func (dmc *dateMetricIDCache) syncLocked() {
|
||||
for date := range allDatesMap {
|
||||
dates = append(dates, date)
|
||||
}
|
||||
sort.Slice(dates, func(i, j int) bool {
|
||||
return dates[i] < dates[j]
|
||||
})
|
||||
slices.Sort(dates)
|
||||
if len(dates) > 2 {
|
||||
dates = dates[len(dates)-2:]
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package storage
|
||||
import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/VictoriaMetrics/VictoriaMetrics/lib/fasttime"
|
||||
@@ -114,9 +114,7 @@ func (s *Storage) mustOpenLegacyIndexDBTables(path string) *legacyIndexDBs {
|
||||
}
|
||||
tableNames = append(tableNames, tableName)
|
||||
}
|
||||
sort.Slice(tableNames, func(i, j int) bool {
|
||||
return tableNames[i] < tableNames[j]
|
||||
})
|
||||
slices.Sort(tableNames)
|
||||
|
||||
if len(tableNames) > 3 {
|
||||
// Remove all the tables except the last three tables.
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
@@ -802,9 +801,7 @@ func mustConvertToLegacy(s *Storage) *Storage {
|
||||
for _, e := range entries {
|
||||
names = append(names, e.Name())
|
||||
}
|
||||
sort.Slice(names, func(i, j int) bool {
|
||||
return names[i] < names[j]
|
||||
})
|
||||
slices.Sort(names)
|
||||
if len(names) > 2 {
|
||||
for _, name := range names[:len(names)-2] {
|
||||
p := filepath.Join(legacyIDBsPathOrig, name)
|
||||
|
||||
Reference in New Issue
Block a user