[#1646] cli: Use Cmp() functions for ID-like structs
All checks were successful
DCO action / DCO (pull_request) Successful in 37s
Vulncheck / Vulncheck (pull_request) Successful in 52s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m23s
Build / Build Components (pull_request) Successful in 1m30s
Tests and linters / Run gofumpt (pull_request) Successful in 2m10s
Tests and linters / Lint (pull_request) Successful in 2m26s
Tests and linters / Tests (pull_request) Successful in 2m32s
Tests and linters / Staticcheck (pull_request) Successful in 2m42s
Tests and linters / Tests with -race (pull_request) Successful in 3m49s
Tests and linters / gopls check (pull_request) Successful in 3m47s
All checks were successful
DCO action / DCO (pull_request) Successful in 37s
Vulncheck / Vulncheck (pull_request) Successful in 52s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m23s
Build / Build Components (pull_request) Successful in 1m30s
Tests and linters / Run gofumpt (pull_request) Successful in 2m10s
Tests and linters / Lint (pull_request) Successful in 2m26s
Tests and linters / Tests (pull_request) Successful in 2m32s
Tests and linters / Staticcheck (pull_request) Successful in 2m42s
Tests and linters / Tests with -race (pull_request) Successful in 3m49s
Tests and linters / gopls check (pull_request) Successful in 3m47s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
02f3a7f65c
commit
b2adf1109e
1 changed files with 2 additions and 7 deletions
|
@ -9,7 +9,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/accounting"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum"
|
||||||
|
@ -77,9 +76,7 @@ func ListContainers(ctx context.Context, prm ListContainersPrm) (res ListContain
|
||||||
// SortedIDList returns sorted list of identifiers of user's containers.
|
// SortedIDList returns sorted list of identifiers of user's containers.
|
||||||
func (x ListContainersRes) SortedIDList() []cid.ID {
|
func (x ListContainersRes) SortedIDList() []cid.ID {
|
||||||
list := x.cliRes.Containers()
|
list := x.cliRes.Containers()
|
||||||
slices.SortFunc(list, func(lhs, rhs cid.ID) int {
|
slices.SortFunc(list, cid.ID.Cmp)
|
||||||
return strings.Compare(lhs.EncodeToString(), rhs.EncodeToString())
|
|
||||||
})
|
|
||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,9 +684,7 @@ func SearchObjects(ctx context.Context, prm SearchObjectsPrm) (*SearchObjectsRes
|
||||||
return nil, fmt.Errorf("read object list: %w", err)
|
return nil, fmt.Errorf("read object list: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
slices.SortFunc(list, func(a, b oid.ID) int {
|
slices.SortFunc(list, oid.ID.Cmp)
|
||||||
return strings.Compare(a.EncodeToString(), b.EncodeToString())
|
|
||||||
})
|
|
||||||
|
|
||||||
return &SearchObjectsRes{
|
return &SearchObjectsRes{
|
||||||
ids: list,
|
ids: list,
|
||||||
|
|
Loading…
Add table
Reference in a new issue