[#1646] cli: Use Cmp() functions for ID-like structs
Some checks failed
DCO action / DCO (pull_request) Successful in 36s
Vulncheck / Vulncheck (pull_request) Failing after 53s
Tests and linters / Tests (pull_request) Failing after 59s
Build / Build Components (pull_request) Failing after 1m5s
Tests and linters / Lint (pull_request) Failing after 1m9s
Tests and linters / Run gofumpt (pull_request) Failing after 1m7s
Tests and linters / Staticcheck (pull_request) Failing after 1m14s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m24s
Tests and linters / Tests with -race (pull_request) Failing after 2m58s
Tests and linters / gopls check (pull_request) Failing after 2m59s
Some checks failed
DCO action / DCO (pull_request) Successful in 36s
Vulncheck / Vulncheck (pull_request) Failing after 53s
Tests and linters / Tests (pull_request) Failing after 59s
Build / Build Components (pull_request) Failing after 1m5s
Tests and linters / Lint (pull_request) Failing after 1m9s
Tests and linters / Run gofumpt (pull_request) Failing after 1m7s
Tests and linters / Staticcheck (pull_request) Failing after 1m14s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m24s
Tests and linters / Tests with -race (pull_request) Failing after 2m58s
Tests and linters / gopls check (pull_request) Failing after 2m59s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
fe0cf86dc6
commit
a73fb5c462
1 changed files with 5 additions and 11 deletions
|
@ -6,11 +6,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"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"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||||
|
@ -20,6 +15,9 @@ import (
|
||||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errMissingHeaderInResponse = errors.New("missing header in response")
|
var errMissingHeaderInResponse = errors.New("missing header in response")
|
||||||
|
@ -77,9 +75,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 +683,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