Merge pull request #436 from status-im/bugfix/fix-linter-435
Fixes all make lint errors and warning across the whole project.
This commit is contained in:
commit
55b10483be
|
@ -27,7 +27,7 @@ func faucetCommandHandler(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Starting Status Faucet node..")
|
fmt.Println("Starting Status Faucet node..")
|
||||||
if err := statusAPI.StartNode(config); err != nil {
|
if err = statusAPI.StartNode(config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ func lesCommandHandler(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Starting Light Status node..")
|
fmt.Println("Starting Light Status node..")
|
||||||
if err := statusAPI.StartNode(config); err != nil {
|
if err = statusAPI.StartNode(config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ func wnode(ctx *cli.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := statusAPI.StartNode(config); err != nil {
|
if err = statusAPI.StartNode(config); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ func makeWhisperNodeConfig(ctx *cli.Context) (*params.NodeConfig, error) {
|
||||||
if whisperConfig.PasswordFile, err = filepath.Abs(whisperConfig.PasswordFile); err != nil {
|
if whisperConfig.PasswordFile, err = filepath.Abs(whisperConfig.PasswordFile); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if _, err := whisperConfig.ReadPasswordFile(); err != nil {
|
if _, err = whisperConfig.ReadPasswordFile(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ func makeWhisperNodeConfig(ctx *cli.Context) (*params.NodeConfig, error) {
|
||||||
if whisperConfig.IdentityFile, err = filepath.Abs(whisperConfig.IdentityFile); err != nil {
|
if whisperConfig.IdentityFile, err = filepath.Abs(whisperConfig.IdentityFile); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if _, err := whisperConfig.ReadIdentityFile(); err != nil {
|
if _, err = whisperConfig.ReadIdentityFile(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,11 +124,7 @@ func (s *JailRPCTestSuite) TestContractDeployment() {
|
||||||
|
|
||||||
var txHash gethcommon.Hash
|
var txHash gethcommon.Hash
|
||||||
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) {
|
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) {
|
||||||
var (
|
var envelope signal.Envelope
|
||||||
envelope signal.Envelope
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
||||||
s.NoError(err, "cannot unmarshal JSON: %s", jsonEvent)
|
s.NoError(err, "cannot unmarshal JSON: %s", jsonEvent)
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ func (s *JailTestSuite) TestEventSignal() {
|
||||||
// replace transaction notification handler
|
// replace transaction notification handler
|
||||||
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) {
|
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) {
|
||||||
var envelope signal.Envelope
|
var envelope signal.Envelope
|
||||||
err := json.Unmarshal([]byte(jsonEvent), &envelope)
|
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
||||||
s.NoError(err)
|
s.NoError(err)
|
||||||
|
|
||||||
if envelope.Type == jail.EventSignal {
|
if envelope.Type == jail.EventSignal {
|
||||||
|
|
|
@ -153,7 +153,7 @@ func (s *TransactionsTestSuite) TestSendContractTx() {
|
||||||
var txHash gethcommon.Hash
|
var txHash gethcommon.Hash
|
||||||
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint :dupl
|
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint :dupl
|
||||||
var envelope signal.Envelope
|
var envelope signal.Envelope
|
||||||
err := json.Unmarshal([]byte(jsonEvent), &envelope)
|
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
||||||
s.NoError(err, fmt.Sprintf("cannot unmarshal JSON: %s", jsonEvent))
|
s.NoError(err, fmt.Sprintf("cannot unmarshal JSON: %s", jsonEvent))
|
||||||
|
|
||||||
if envelope.Type == txqueue.EventTransactionQueued {
|
if envelope.Type == txqueue.EventTransactionQueued {
|
||||||
|
@ -244,7 +244,7 @@ func (s *TransactionsTestSuite) TestSendEther() {
|
||||||
var txHash = gethcommon.Hash{}
|
var txHash = gethcommon.Hash{}
|
||||||
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint: dupl
|
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint: dupl
|
||||||
var envelope signal.Envelope
|
var envelope signal.Envelope
|
||||||
err := json.Unmarshal([]byte(jsonEvent), &envelope)
|
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
||||||
s.NoError(err, fmt.Sprintf("cannot unmarshal JSON: %s", jsonEvent))
|
s.NoError(err, fmt.Sprintf("cannot unmarshal JSON: %s", jsonEvent))
|
||||||
|
|
||||||
if envelope.Type == txqueue.EventTransactionQueued {
|
if envelope.Type == txqueue.EventTransactionQueued {
|
||||||
|
@ -327,7 +327,7 @@ func (s *TransactionsTestSuite) TestSendEtherTxUpstream() {
|
||||||
var txHash = gethcommon.Hash{}
|
var txHash = gethcommon.Hash{}
|
||||||
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint: dupl
|
signal.SetDefaultNodeNotificationHandler(func(jsonEvent string) { // nolint: dupl
|
||||||
var envelope signal.Envelope
|
var envelope signal.Envelope
|
||||||
err := json.Unmarshal([]byte(jsonEvent), &envelope)
|
err = json.Unmarshal([]byte(jsonEvent), &envelope)
|
||||||
s.NoError(err, "cannot unmarshal JSON: %s", jsonEvent)
|
s.NoError(err, "cannot unmarshal JSON: %s", jsonEvent)
|
||||||
|
|
||||||
if envelope.Type == txqueue.EventTransactionQueued {
|
if envelope.Type == txqueue.EventTransactionQueued {
|
||||||
|
|
|
@ -80,7 +80,7 @@ func (m *NodeManager) startNode(config *params.NodeConfig) (<-chan struct{}, err
|
||||||
defer HaltOnPanic()
|
defer HaltOnPanic()
|
||||||
|
|
||||||
// start underlying node
|
// start underlying node
|
||||||
if err := ethNode.Start(); err != nil {
|
if startErr := ethNode.Start(); startErr != nil {
|
||||||
close(m.nodeStarted)
|
close(m.nodeStarted)
|
||||||
m.Lock()
|
m.Lock()
|
||||||
m.nodeStarted = nil
|
m.nodeStarted = nil
|
||||||
|
@ -88,7 +88,7 @@ func (m *NodeManager) startNode(config *params.NodeConfig) (<-chan struct{}, err
|
||||||
signal.Send(signal.Envelope{
|
signal.Send(signal.Envelope{
|
||||||
Type: signal.EventNodeCrashed,
|
Type: signal.EventNodeCrashed,
|
||||||
Event: signal.NodeCrashEvent{
|
Event: signal.NodeCrashEvent{
|
||||||
Error: fmt.Errorf("%v: %v", ErrNodeStartFailure, err).Error(),
|
Error: fmt.Errorf("%v: %v", ErrNodeStartFailure, startErr).Error(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|
|
@ -239,9 +239,9 @@ func (m *Manager) completeRemoteTransaction(queuedTx *common.QueuedTx, password
|
||||||
args := queuedTx.Args
|
args := queuedTx.Args
|
||||||
|
|
||||||
if args.GasPrice == nil {
|
if args.GasPrice == nil {
|
||||||
value, err := m.gasPrice()
|
value, gasPriceErr := m.gasPrice()
|
||||||
if err != nil {
|
if gasPriceErr != nil {
|
||||||
return emptyHash, err
|
return emptyHash, gasPriceErr
|
||||||
}
|
}
|
||||||
|
|
||||||
args.GasPrice = value
|
args.GasPrice = value
|
||||||
|
|
|
@ -6,17 +6,11 @@ lint-deps:
|
||||||
go get -u github.com/alecthomas/gometalinter
|
go get -u github.com/alecthomas/gometalinter
|
||||||
gometalinter --install
|
gometalinter --install
|
||||||
|
|
||||||
lint: lint-vet lint-vetshadow lint-goimports lint-gofmt lint-deadcode lint-misspell lint-unparam lint-unused lint-gocyclo lint-errcheck lint-ineffassign lint-interfacer lint-unconvert lint-staticcheck lint-goconst lint-gas lint-varcheck lint-structcheck lint-gosimple
|
lint: lint-vet lint-gofmt lint-deadcode lint-misspell lint-unparam lint-unused lint-gocyclo lint-errcheck lint-ineffassign lint-interfacer lint-unconvert lint-staticcheck lint-goconst lint-gas lint-varcheck lint-structcheck lint-gosimple
|
||||||
|
|
||||||
lint-vet:
|
lint-vet:
|
||||||
@echo "lint-vet"
|
@echo "lint-vet"
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=vet --deadline=45s $(LINT_FOLDERS)
|
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=vet --deadline=45s $(LINT_FOLDERS)
|
||||||
lint-vetshadow:
|
|
||||||
@echo "lint-vetshadow"
|
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=vetshadow --deadline=45s $(LINT_FOLDERS)
|
|
||||||
lint-goimports:
|
|
||||||
@echo "lint-goimports"
|
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=goimports --deadline=45s $(LINT_FOLDERS)
|
|
||||||
lint-golint:
|
lint-golint:
|
||||||
@echo "lint-golint"
|
@echo "lint-golint"
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=golint --deadline=45s $(LINT_FOLDERS)
|
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=golint --deadline=45s $(LINT_FOLDERS)
|
||||||
|
@ -37,7 +31,7 @@ lint-unused:
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=unused --deadline=45s $(LINT_FOLDERS)
|
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=unused --deadline=45s $(LINT_FOLDERS)
|
||||||
lint-gocyclo:
|
lint-gocyclo:
|
||||||
@echo "lint-gocyclo"
|
@echo "lint-gocyclo"
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gocyclo --cyclo-over=20 --deadline=45s $(LINT_FOLDERS)
|
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gocyclo --cyclo-over=16 --deadline=45s $(LINT_FOLDERS)
|
||||||
lint-errcheck:
|
lint-errcheck:
|
||||||
@echo "lint-errcheck"
|
@echo "lint-errcheck"
|
||||||
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=errcheck --deadline=45s $(LINT_FOLDERS)
|
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=errcheck --deadline=45s $(LINT_FOLDERS)
|
||||||
|
|
Loading…
Reference in New Issue