[#23] pre-commit: Add golangci-lint hook

Also, fix minor issues. Skip deprecated warning for now.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-03-03 12:44:36 +03:00
parent b761fd8070
commit b461aa64b8
4 changed files with 13 additions and 5 deletions

View file

@ -24,6 +24,9 @@ linters-settings:
govet:
# report about shadowed variables
check-shadowing: false
staticcheck:
checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed.
linters:
enable:

View file

@ -17,3 +17,8 @@ repos:
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
exclude: ".key$"
- repo: https://github.com/golangci/golangci-lint
rev: v1.51.2
hooks:
- id: golangci-lint

View file

@ -117,7 +117,7 @@ func (o *Object) Signature() *frostfscrypto.Signature {
}
var sig frostfscrypto.Signature
sig.ReadFromV2(*sigv2) // FIXME(@cthulhu-rider): #226 handle error
_ = sig.ReadFromV2(*sigv2) // FIXME(@cthulhu-rider): #226 handle error
return &sig
}
@ -149,7 +149,7 @@ func (o *Object) SetPayload(v []byte) {
func (o *Object) Version() *version.Version {
var ver version.Version
if verV2 := (*object.Object)(o).GetHeader().GetVersion(); verV2 != nil {
ver.ReadFromV2(*verV2) // FIXME(@cthulhu-rider): #226 handle error
_ = ver.ReadFromV2(*verV2) // FIXME(@cthulhu-rider): #226 handle error
}
return &ver
}
@ -248,7 +248,7 @@ func (o *Object) PayloadChecksum() (checksum.Checksum, bool) {
v2 := (*object.Object)(o)
if hash := v2.GetHeader().GetPayloadHash(); hash != nil {
v.ReadFromV2(*hash) // FIXME(@cthulhu-rider): #226 handle error
_ = v.ReadFromV2(*hash) // FIXME(@cthulhu-rider): #226 handle error
return v, true
}
@ -278,7 +278,7 @@ func (o *Object) PayloadHomomorphicHash() (checksum.Checksum, bool) {
v2 := (*object.Object)(o)
if hash := v2.GetHeader().GetHomomorphicHash(); hash != nil {
v.ReadFromV2(*hash) // FIXME(@cthulhu-rider): #226 handle error
_ = v.ReadFromV2(*hash) // FIXME(@cthulhu-rider): #226 handle error
return v, true
}

View file

@ -114,7 +114,7 @@ func (sg *StorageGroup) SetValidationDataSize(epoch uint64) {
func (sg StorageGroup) ValidationDataHash() (v checksum.Checksum, isSet bool) {
v2 := (storagegroup.StorageGroup)(sg)
if checksumV2 := v2.GetValidationHash(); checksumV2 != nil {
v.ReadFromV2(*checksumV2) // FIXME(@cthulhu-rider): #226 handle error
_ = v.ReadFromV2(*checksumV2) // FIXME(@cthulhu-rider): #226 handle error
isSet = true
}