Skip to content

Commit

Permalink
fix linter (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov authored Oct 7, 2024
1 parent 2756fce commit 16b3534
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ output:

# all available settings of specific linters
linters-settings:
gosec:
# TODO: fix all issues with int overflow and return this rule back
excludes:
- G115
dogsled:
# checks assignments with too many blank identifiers; default is 2
max-blank-identifiers: 2
Expand Down
10 changes: 5 additions & 5 deletions ekm/signer_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *storage) OpenWallet() (core.Wallet, error) {
if err != nil {
return nil, errors.Wrap(err, "failed to open wallet")
}
if obj.Value == nil || len(obj.Value) == 0 {
if len(obj.Value) == 0 {
return nil, errors.New("failed to open wallet")
}
// decode
Expand Down Expand Up @@ -280,7 +280,7 @@ func (s *storage) RetrieveHighestAttestation(pubKey []byte) (*phase0.Attestation
if !found {
return nil, false, nil
}
if obj.Value == nil || len(obj.Value) == 0 {
if len(obj.Value) == 0 {
return nil, found, errors.Wrap(err, "highest attestation value is empty")
}

Expand Down Expand Up @@ -333,7 +333,7 @@ func (s *storage) RetrieveHighestProposal(pubKey []byte) (phase0.Slot, bool, err
if !found {
return 0, found, nil
}
if obj.Value == nil || len(obj.Value) == 0 {
if len(obj.Value) == 0 {
return 0, found, errors.Wrap(err, "highest proposal value is empty")
}

Expand All @@ -350,7 +350,7 @@ func (s *storage) RemoveHighestProposal(pubKey []byte) error {
}

func (s *storage) decryptData(objectValue []byte) ([]byte, error) {
if s.encryptionKey == nil || len(s.encryptionKey) == 0 {
if len(s.encryptionKey) == 0 {
return objectValue, nil
}

Expand All @@ -363,7 +363,7 @@ func (s *storage) decryptData(objectValue []byte) ([]byte, error) {
}

func (s *storage) encryptData(objectValue []byte) ([]byte, error) {
if s.encryptionKey == nil || len(s.encryptionKey) == 0 {
if len(s.encryptionKey) == 0 {
return objectValue, nil
}

Expand Down
6 changes: 5 additions & 1 deletion integration/qbft/tests/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tests

import (
"context"
"os"
"testing"

spectypes "github.com/bloxapp/ssv-spec/types"
Expand Down Expand Up @@ -61,10 +62,13 @@ func TestMain(m *testing.M) {
Nodes: nodes,
}

m.Run()
// exitCode required here only for linter
exitCode := m.Run()

//teardown
for i := 0; i < len(ln.Nodes); i++ {
_ = ln.Nodes[i].Close()
}

os.Exit(exitCode)
}
6 changes: 3 additions & 3 deletions operator/keys/rsa_linux_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// go:build linux
//go:build linux

package keys

import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"testing"

"github.com/stretchr/testify/require"

"testing"
)

func Test_VerifyRegularSigWithOpenSSL(t *testing.T) {
Expand Down

0 comments on commit 16b3534

Please sign in to comment.