forked from TrueCloudLab/frostfs-api-go
[#199] sdk/object: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3a966ee5df
commit
1ff8b3fd94
2 changed files with 8 additions and 2 deletions
|
@ -10,6 +10,10 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var errCheckSumMismatch = errors.New("payload checksum mismatch")
|
||||
|
||||
var errIncorrectID = errors.New("incorrect object identifier")
|
||||
|
||||
// CalculatePayloadChecksum calculates and returns checksum of
|
||||
// object payload bytes.
|
||||
func CalculatePayloadChecksum(payload []byte) *pkg.Checksum {
|
||||
|
@ -34,7 +38,7 @@ func VerifyPayloadChecksum(obj *Object) error {
|
|||
obj.PayloadChecksum(),
|
||||
CalculatePayloadChecksum(obj.Payload()),
|
||||
) {
|
||||
return errors.New("payload checksum mismatch")
|
||||
return errCheckSumMismatch
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -75,7 +79,7 @@ func VerifyID(obj *Object) error {
|
|||
}
|
||||
|
||||
if !id.Equal(obj.ID()) {
|
||||
return errors.New("incorrect object identifier")
|
||||
return errIncorrectID
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -138,6 +138,7 @@ func NewSearchFilters() SearchFilters {
|
|||
|
||||
func NewSearchFiltersFromV2(v2 []*v2object.SearchFilter) SearchFilters {
|
||||
filters := make(SearchFilters, 0, len(v2))
|
||||
|
||||
for i := range v2 {
|
||||
if v2[i] == nil {
|
||||
continue
|
||||
|
@ -197,6 +198,7 @@ func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID)
|
|||
|
||||
func (f SearchFilters) ToV2() []*v2object.SearchFilter {
|
||||
result := make([]*v2object.SearchFilter, 0, len(f))
|
||||
|
||||
for i := range f {
|
||||
v2 := new(v2object.SearchFilter)
|
||||
v2.SetKey(f[i].header.String())
|
||||
|
|
Loading…
Reference in a new issue