[#1453] container: Replace sort.Slice
with slices.SortFunc
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 2m59s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m29s
Tests and linters / Run gofumpt (pull_request) Successful in 3m43s
Tests and linters / gopls check (pull_request) Successful in 3m52s
DCO action / DCO (pull_request) Successful in 4m6s
Build / Build Components (pull_request) Successful in 4m43s
Tests and linters / Tests (pull_request) Successful in 5m37s
Tests and linters / Staticcheck (pull_request) Successful in 5m34s
Tests and linters / Lint (pull_request) Successful in 6m11s
Tests and linters / Tests with -race (pull_request) Successful in 6m48s
All checks were successful
Vulncheck / Vulncheck (pull_request) Successful in 2m59s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m29s
Tests and linters / Run gofumpt (pull_request) Successful in 3m43s
Tests and linters / gopls check (pull_request) Successful in 3m52s
DCO action / DCO (pull_request) Successful in 4m6s
Build / Build Components (pull_request) Successful in 4m43s
Tests and linters / Tests (pull_request) Successful in 5m37s
Tests and linters / Staticcheck (pull_request) Successful in 5m34s
Tests and linters / Lint (pull_request) Successful in 6m11s
Tests and linters / Tests with -race (pull_request) Successful in 6m48s
* Replaced `sort.Slice` with `slices.SortFunc` in
`ListContainersRes.SortedIDList()` as it is a bit faster,
according to 15102e6dfd
.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
af64263b93
commit
75ac7278dd
1 changed files with 2 additions and 4 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting"
|
||||
|
@ -78,9 +77,8 @@ func ListContainers(ctx context.Context, prm ListContainersPrm) (res ListContain
|
|||
// SortedIDList returns sorted list of identifiers of user's containers.
|
||||
func (x ListContainersRes) SortedIDList() []cid.ID {
|
||||
list := x.cliRes.Containers()
|
||||
sort.Slice(list, func(i, j int) bool {
|
||||
lhs, rhs := list[i].EncodeToString(), list[j].EncodeToString()
|
||||
return strings.Compare(lhs, rhs) < 0
|
||||
slices.SortFunc(list, func(lhs, rhs cid.ID) int {
|
||||
return strings.Compare(lhs.EncodeToString(), rhs.EncodeToString())
|
||||
})
|
||||
return list
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue