update linter
This commit is contained in:
parent
012a1b54bc
commit
1c33220834
2
Makefile
2
Makefile
|
@ -269,7 +269,7 @@ canary-test: node-canary
|
|||
|
||||
lint-install:
|
||||
@# The following installs a specific version of golangci-lint, which is appropriate for a CI server to avoid different results from build to build
|
||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $(GOPATH)/bin v1.10.2
|
||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $(GOPATH)/bin v1.17.1
|
||||
|
||||
lint:
|
||||
@echo "lint"
|
||||
|
|
|
@ -95,9 +95,7 @@ func main() {
|
|||
)
|
||||
if err != nil {
|
||||
printUsage()
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
}
|
||||
logger.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
|
|
@ -617,7 +617,7 @@ func TestChildForPurpose(t *testing.T) {
|
|||
|
||||
// Check that the key generated by ChildForPurpose with KeyPurposeChat is different from the BIP44
|
||||
if walletChild.String() == chatChild.String() {
|
||||
t.Errorf("wrong chat key. expected to be diferrent from the wallet key")
|
||||
t.Errorf("wrong chat key. expected to be different from the wallet key")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,8 +94,8 @@ func TestGetFilterLogs(t *testing.T) {
|
|||
logs, err := api.GetFilterLogs(context.TODO(), id)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, logs)
|
||||
require.Len(t, tracker.criterias, 1)
|
||||
rst, err := hexutil.DecodeBig(tracker.criterias[0]["fromBlock"].(string))
|
||||
require.Len(t, tracker.criteria, 1)
|
||||
rst, err := hexutil.DecodeBig(tracker.criteria[0]["fromBlock"].(string))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, block, rst)
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ import (
|
|||
)
|
||||
|
||||
type callTracker struct {
|
||||
mu sync.Mutex
|
||||
calls int
|
||||
reply [][]types.Log
|
||||
criterias []map[string]interface{}
|
||||
mu sync.Mutex
|
||||
calls int
|
||||
reply [][]types.Log
|
||||
criteria []map[string]interface{}
|
||||
}
|
||||
|
||||
func (c *callTracker) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
|
||||
|
@ -31,7 +31,7 @@ func (c *callTracker) CallContext(ctx context.Context, result interface{}, metho
|
|||
return errors.New("unexpected length of args")
|
||||
}
|
||||
crit := args[0].(map[string]interface{})
|
||||
c.criterias = append(c.criterias, crit)
|
||||
c.criteria = append(c.criteria, crit)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return errors.New("context canceled")
|
||||
|
@ -73,7 +73,7 @@ func runLogsFetcherTest(t *testing.T, f *logsFilter, replies [][]types.Log, quer
|
|||
}
|
||||
}()
|
||||
wg.Wait()
|
||||
require.Len(t, c.criterias, queries)
|
||||
require.Len(t, c.criteria, queries)
|
||||
return &c
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,8 @@ func TestLogsFetcherAdjusted(t *testing.T) {
|
|||
{BlockNumber: 11}, {BlockNumber: 12},
|
||||
}
|
||||
c := runLogsFetcherTest(t, f, [][]types.Log{logs}, 2)
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
||||
require.Equal(t, c.criterias[1]["fromBlock"], "latest")
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||
require.Equal(t, c.criteria[1]["fromBlock"], "latest")
|
||||
}
|
||||
|
||||
func TestAdjustedDueToReorg(t *testing.T) {
|
||||
|
@ -110,9 +110,9 @@ func TestAdjustedDueToReorg(t *testing.T) {
|
|||
{BlockNumber: 12, BlockHash: common.Hash{2, 2}},
|
||||
}
|
||||
c := runLogsFetcherTest(t, f, [][]types.Log{logs, reorg}, 3)
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
||||
require.Equal(t, "latest", c.criterias[1]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(11)), c.criterias[2]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||
require.Equal(t, "latest", c.criteria[1]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(11)), c.criteria[2]["fromBlock"])
|
||||
}
|
||||
|
||||
func TestLogsFetcherCanceledContext(t *testing.T) {
|
||||
|
@ -127,6 +127,6 @@ func TestLogsFetcherCanceledContext(t *testing.T) {
|
|||
}
|
||||
cancel()
|
||||
c := runLogsFetcherTest(t, f, [][]types.Log{make([]types.Log, 2)}, 2)
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[0]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criterias[1]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[0]["fromBlock"])
|
||||
require.Equal(t, hexutil.EncodeBig(big.NewInt(10)), c.criteria[1]["fromBlock"])
|
||||
}
|
||||
|
|
|
@ -650,9 +650,6 @@ func (api *PublicAPI) SendPairingMessage(ctx context.Context, msg chat.SendDirec
|
|||
}
|
||||
|
||||
msg.PubKey = crypto.FromECDSAPub(&privateKey.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
protocolMessage, err := api.service.protocol.BuildDHMessage(privateKey, &privateKey.PublicKey, msg.Payload)
|
||||
if err != nil {
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
)
|
||||
|
||||
|
@ -103,11 +104,7 @@ func EncryptSymmetric(key, plaintext []byte) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
encrypted, err := aesgcm.Seal(nil, salt, plaintext, nil), nil
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
encrypted := aesgcm.Seal(nil, salt, plaintext, nil)
|
||||
return append(encrypted, salt...), nil
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ func TestSymmetricEncryption(t *testing.T) {
|
|||
t,
|
||||
32,
|
||||
len(cyphertext1),
|
||||
"Cyphertext with the correct lenght should be generated")
|
||||
"Cyphertext with the correct length should be generated")
|
||||
|
||||
require.NotEqualf(
|
||||
t,
|
||||
|
|
|
@ -122,7 +122,7 @@ func (ps *ConnectionManager) Start() {
|
|||
continue
|
||||
}
|
||||
failuresPerServer[ev.Peer]++
|
||||
log.Debug("request to a mail server expired, disconncet a peer", "address", ev.Peer)
|
||||
log.Debug("request to a mail server expired, disconnect a peer", "address", ev.Peer)
|
||||
if failuresPerServer[ev.Peer] >= ps.maxFailures {
|
||||
state.nodeDisconnected(ev.Peer)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ const (
|
|||
defaultTimeoutWaitAdded = 5 * time.Second
|
||||
)
|
||||
|
||||
var errProtocolNotInitialized = errors.New("procotol is not initialized")
|
||||
var errProtocolNotInitialized = errors.New("protocol is not initialized")
|
||||
|
||||
// EnvelopeEventsHandler used for two different event types.
|
||||
type EnvelopeEventsHandler interface {
|
||||
|
|
Loading…
Reference in New Issue