forked from TrueCloudLab/frostfs-node
Revert "[#972] Use slices.Sort* when useful"
This reverts commit b871d7a5e8
.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
946f2ec2bf
commit
3359349acb
2 changed files with 9 additions and 4 deletions
|
@ -3,7 +3,7 @@ package control
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"slices"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
|
@ -177,6 +177,9 @@ func getShardIDListFromIDFlag(cmd *cobra.Command, withAllFlag bool) [][]byte {
|
||||||
res = append(res, raw)
|
res = append(res, raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
slices.SortFunc(res, bytes.Compare)
|
sort.Slice(res, func(i, j int) bool {
|
||||||
|
return bytes.Compare(res[i], res[j]) < 0
|
||||||
|
})
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"path"
|
"path"
|
||||||
"slices"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama"
|
||||||
|
@ -177,7 +177,9 @@ func TestGetSubTreeOrderAsc(t *testing.T) {
|
||||||
require.True(t, found, "unknown node")
|
require.True(t, found, "unknown node")
|
||||||
}
|
}
|
||||||
|
|
||||||
require.True(t, slices.IsSorted(paths))
|
require.True(t, sort.SliceIsSorted(paths, func(i, j int) bool {
|
||||||
|
return paths[i] < paths[j]
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in a new issue