Use gometalinter config instead of makefile (#560)

This commit is contained in:
Daniel Nephin 2018-01-24 03:25:28 -05:00 committed by Adam Babik
parent e214e1e270
commit 755a646bd4
11 changed files with 95 additions and 124 deletions

28
.gometalinter.json Normal file
View File

@ -0,0 +1,28 @@
{
"Exclude": [
".*_mock.go",
"geth/jail/doc.go"
],
"Skip": ["helpers", "static"],
"Vendor": true,
"Enable": [
"deadcode",
"errcheck",
"gas",
"goconst",
"gocyclo",
"gofmt",
"golint",
"ineffassign",
"interfacer",
"megacheck",
"misspell",
"structcheck",
"unconvert",
"unparam",
"varcheck",
"vet"
],
"Cyclo": 16,
"Deadline": "100s"
}

View File

@ -4,8 +4,6 @@
help: ##@other Show this help help: ##@other Show this help
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
include ./static/tools/mk/lint.mk
ifndef GOPATH ifndef GOPATH
$(error GOPATH not set. Please set GOPATH and make sure status-go is located at $$GOPATH/src/github.com/status-im/status-go. \ $(error GOPATH not set. Please set GOPATH and make sure status-go is located at $$GOPATH/src/github.com/status-im/status-go. \
For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH) For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH)
@ -136,6 +134,14 @@ test-e2e: ##@tests Run e2e tests
# e2e_test tag is required to include some files from ./lib without _test suffix # e2e_test tag is required to include some files from ./lib without _test suffix
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) go test -timeout 40m -tags e2e_test ./lib -network=$(networkid)
lint-install:
go get -u github.com/alecthomas/gometalinter
gometalinter --install
lint:
@echo "lint"
@gometalinter ./...
ci: lint mock test-unit test-e2e ##@tests Run all linters and tests at once ci: lint mock test-unit test-e2e ##@tests Run all linters and tests at once
clean: ##@other Cleanup clean: ##@other Cleanup

View File

@ -80,14 +80,14 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String()) messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String())
//Threre are no messages at filter //Threre are no messages at filter
messages := s.getMessagesByMessageFilterId(rpcClient, messageFilterID) messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//Post message //Post message
s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!"))) s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!")))
//There are no messages, because it's a sender filter //There are no messages, because it's a sender filter
messages = s.getMessagesByMessageFilterId(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//act //act
@ -114,11 +114,11 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
//wait to receive message //wait to receive message
time.Sleep(time.Second) time.Sleep(time.Second)
//And we receive message //And we receive message
messages = s.getMessagesByMessageFilterId(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
//check that there are no messages //check that there are no messages
messages = s.getMessagesByMessageFilterId(rpcClient, messageFilterID) messages = s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
} }
@ -158,9 +158,9 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
charlieWhisperService, err := charlieBackend.NodeManager().WhisperService() charlieWhisperService, err := charlieBackend.NodeManager().WhisperService()
s.Require().NoError(err) s.Require().NoError(err)
//get rpc client //get rpc client
aliceRpcClient := aliceBackend.NodeManager().RPCClient() aliceRPCClient := aliceBackend.NodeManager().RPCClient()
bobRpcClient := bobBackend.NodeManager().RPCClient() bobRPCClient := bobBackend.NodeManager().RPCClient()
charlieRpcClient := charlieBackend.NodeManager().RPCClient() charlieRPCClient := charlieBackend.NodeManager().RPCClient()
//bob and charlie add mailserver key //bob and charlie add mailserver key
password := "status-offline-inbox" password := "status-offline-inbox"
@ -196,79 +196,79 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
charlieAliceKeySendTopic := whisperv5.BytesToTopic([]byte("charlieAliceKeySendTopic ")) charlieAliceKeySendTopic := whisperv5.BytesToTopic([]byte("charlieAliceKeySendTopic "))
//bob and charlie create message filter //bob and charlie create message filter
bobMessageFilterID := s.createPrivateChatMessageFilter(bobRpcClient, bobKeyID, bobAliceKeySendTopic.String()) bobMessageFilterID := s.createPrivateChatMessageFilter(bobRPCClient, bobKeyID, bobAliceKeySendTopic.String())
charlieMessageFilterID := s.createPrivateChatMessageFilter(charlieRpcClient, charlieKeyID, charlieAliceKeySendTopic.String()) charlieMessageFilterID := s.createPrivateChatMessageFilter(charlieRPCClient, charlieKeyID, charlieAliceKeySendTopic.String())
//Alice send message with symkey and topic to bob and charlie //Alice send message with symkey and topic to bob and charlie
s.postMessageToPrivate(aliceRpcClient, bobPubkey.String(), bobAliceKeySendTopic.String(), payloadStr) s.postMessageToPrivate(aliceRPCClient, bobPubkey.String(), bobAliceKeySendTopic.String(), payloadStr)
s.postMessageToPrivate(aliceRpcClient, charliePubkey.String(), charlieAliceKeySendTopic.String(), payloadStr) s.postMessageToPrivate(aliceRPCClient, charliePubkey.String(), charlieAliceKeySendTopic.String(), payloadStr)
//wait to receive //wait to receive
time.Sleep(time.Second) time.Sleep(time.Second)
//bob receive group chat data and add it to his node //bob receive group chat data and add it to his node
//1. bob get group chat details //1. bob get group chat details
messages := s.getMessagesByMessageFilterId(bobRpcClient, bobMessageFilterID) messages := s.getMessagesByMessageFilterID(bobRPCClient, bobMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
bobGroupChatData := groupChatParams{} bobGroupChatData := groupChatParams{}
bobGroupChatData.Decode(messages[0]["payload"].(string)) bobGroupChatData.Decode(messages[0]["payload"].(string))
s.EqualValues(groupChatPayload, bobGroupChatData) s.EqualValues(groupChatPayload, bobGroupChatData)
//2. bob add symkey to his node //2. bob add symkey to his node
bobGroupChatSymkeyID := s.addSymKey(bobRpcClient, bobGroupChatData.Key) bobGroupChatSymkeyID := s.addSymKey(bobRPCClient, bobGroupChatData.Key)
s.Require().NotEmpty(bobGroupChatSymkeyID) s.Require().NotEmpty(bobGroupChatSymkeyID)
//3. bob create message filter to node by group chat topic //3. bob create message filter to node by group chat topic
bobGroupChatMessageFilterID := s.createGroupChatMessageFilter(bobRpcClient, bobGroupChatSymkeyID, bobGroupChatData.Topic) bobGroupChatMessageFilterID := s.createGroupChatMessageFilter(bobRPCClient, bobGroupChatSymkeyID, bobGroupChatData.Topic)
//charlie receive group chat data and add it to his node //charlie receive group chat data and add it to his node
//1. charlie get group chat details //1. charlie get group chat details
messages = s.getMessagesByMessageFilterId(charlieRpcClient, charlieMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
charlieGroupChatData := groupChatParams{} charlieGroupChatData := groupChatParams{}
charlieGroupChatData.Decode(messages[0]["payload"].(string)) charlieGroupChatData.Decode(messages[0]["payload"].(string))
s.EqualValues(groupChatPayload, charlieGroupChatData) s.EqualValues(groupChatPayload, charlieGroupChatData)
//2. charlie add symkey to his node //2. charlie add symkey to his node
charlieGroupChatSymkeyID := s.addSymKey(charlieRpcClient, charlieGroupChatData.Key) charlieGroupChatSymkeyID := s.addSymKey(charlieRPCClient, charlieGroupChatData.Key)
s.Require().NotEmpty(charlieGroupChatSymkeyID) s.Require().NotEmpty(charlieGroupChatSymkeyID)
//3. charlie create message filter to node by group chat topic //3. charlie create message filter to node by group chat topic
charlieGroupChatMessageFilterID := s.createGroupChatMessageFilter(charlieRpcClient, charlieGroupChatSymkeyID, charlieGroupChatData.Topic) charlieGroupChatMessageFilterID := s.createGroupChatMessageFilter(charlieRPCClient, charlieGroupChatSymkeyID, charlieGroupChatData.Topic)
//alice send message to group chat //alice send message to group chat
helloWorldMessage := hexutil.Encode([]byte("Hello world!")) helloWorldMessage := hexutil.Encode([]byte("Hello world!"))
s.postMessageToGroup(aliceRpcClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage) s.postMessageToGroup(aliceRPCClient, groupChatKeyID, groupChatTopic.String(), helloWorldMessage)
time.Sleep(time.Second) //it need to receive envelopes by bob and charlie nodes time.Sleep(time.Second) //it need to receive envelopes by bob and charlie nodes
//bob receive group chat message //bob receive group chat message
messages = s.getMessagesByMessageFilterId(bobRpcClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//charlie receive group chat message //charlie receive group chat message
messages = s.getMessagesByMessageFilterId(charlieRpcClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//check that we don't receive messages each one time //check that we don't receive messages each one time
messages = s.getMessagesByMessageFilterId(bobRpcClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
messages = s.getMessagesByMessageFilterId(charlieRpcClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//Request each one messages from mailbox using enode //Request each one messages from mailbox using enode
s.requestHistoricMessages(bobRpcClient, mailboxEnode, bobMailServerKeyID, groupChatTopic.String()) s.requestHistoricMessages(bobRPCClient, mailboxEnode, bobMailServerKeyID, groupChatTopic.String())
s.requestHistoricMessages(charlieRpcClient, mailboxEnode, charlieMailServerKeyID, groupChatTopic.String()) s.requestHistoricMessages(charlieRPCClient, mailboxEnode, charlieMailServerKeyID, groupChatTopic.String())
time.Sleep(time.Second) //wait to receive p2p messages time.Sleep(time.Second) //wait to receive p2p messages
//bob receive p2p message from grop chat filter //bob receive p2p message from grop chat filter
messages = s.getMessagesByMessageFilterId(bobRpcClient, bobGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(bobRPCClient, bobGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
//charlie receive p2p message from grop chat filter //charlie receive p2p message from grop chat filter
messages = s.getMessagesByMessageFilterId(charlieRpcClient, charlieGroupChatMessageFilterID) messages = s.getMessagesByMessageFilterID(charlieRPCClient, charlieGroupChatMessageFilterID)
s.Require().Equal(1, len(messages)) s.Require().Equal(1, len(messages))
s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string)) s.Require().Equal(helloWorldMessage, messages[0]["payload"].(string))
} }
@ -434,8 +434,8 @@ func (s *WhisperMailboxSuite) postMessageToGroup(rpcCli *rpc.Client, groupChatKe
s.Require().Nil(postResp.Err) s.Require().Nil(postResp.Err)
} }
//getMessagesByMessageFilterId get received messages by messageFilterID //getMessagesByMessageFilterID get received messages by messageFilterID
func (s *WhisperMailboxSuite) getMessagesByMessageFilterId(rpcCli *rpc.Client, messageFilterID string) []map[string]interface{} { func (s *WhisperMailboxSuite) getMessagesByMessageFilterID(rpcCli *rpc.Client, messageFilterID string) []map[string]interface{} {
resp := rpcCli.CallRaw(`{ resp := rpcCli.CallRaw(`{
"jsonrpc": "2.0", "jsonrpc": "2.0",
"method": "shh_getFilterMessages", "method": "shh_getFilterMessages",

View File

@ -115,9 +115,9 @@ func TestVerifyAccountPasswordWithAccountBeforeEIP55(t *testing.T) {
} }
var ( var (
testErrWhisper = errors.New("Can't return a whisper service") errWhisper = errors.New("Can't return a whisper service")
testErrKeyStore = errors.New("Can't return a key store") errKeyStore = errors.New("Can't return a key store")
testErrAccManager = errors.New("Can't return an account manager") errAccManager = errors.New("Can't return an account manager")
) )
func TestManagerTestSuite(t *testing.T) { func TestManagerTestSuite(t *testing.T) {
@ -198,9 +198,9 @@ func (s *ManagerTestSuite) TestCreateAccount() {
_, _, _, err := s.accManager.CreateAccount(s.password) _, _, _, err := s.accManager.CreateAccount(s.password)
s.NoError(err) s.NoError(err)
s.nodeManager.EXPECT().AccountKeyStore().Return(nil, testErrKeyStore) s.nodeManager.EXPECT().AccountKeyStore().Return(nil, errKeyStore)
_, _, _, err = s.accManager.CreateAccount(s.password) _, _, _, err = s.accManager.CreateAccount(s.password)
s.Equal(testErrKeyStore, err) s.Equal(errKeyStore, err)
} }
func (s *ManagerTestSuite) TestRecoverAccount() { func (s *ManagerTestSuite) TestRecoverAccount() {
@ -210,9 +210,9 @@ func (s *ManagerTestSuite) TestRecoverAccount() {
s.Equal(s.address, addr) s.Equal(s.address, addr)
s.Equal(s.pubKey, pubKey) s.Equal(s.pubKey, pubKey)
s.nodeManager.EXPECT().AccountKeyStore().Return(nil, testErrKeyStore) s.nodeManager.EXPECT().AccountKeyStore().Return(nil, errKeyStore)
_, _, err = s.accManager.RecoverAccount(s.password, s.mnemonic) _, _, err = s.accManager.RecoverAccount(s.password, s.mnemonic)
s.Equal(testErrKeyStore, err) s.Equal(errKeyStore, err)
} }
func (s *ManagerTestSuite) TestSelectAccount() { func (s *ManagerTestSuite) TestSelectAccount() {
@ -234,19 +234,19 @@ func (s *ManagerTestSuite) TestSelectAccount() {
}, },
{ {
"fail_keyStore", "fail_keyStore",
[]interface{}{nil, testErrKeyStore}, []interface{}{nil, errKeyStore},
[]interface{}{s.shh, nil}, []interface{}{s.shh, nil},
s.address, s.address,
s.password, s.password,
testErrKeyStore, errKeyStore,
}, },
{ {
"fail_whisperService", "fail_whisperService",
[]interface{}{s.keyStore, nil}, []interface{}{s.keyStore, nil},
[]interface{}{nil, testErrWhisper}, []interface{}{nil, errWhisper},
s.address, s.address,
s.password, s.password,
testErrWhisper, errWhisper,
}, },
{ {
"fail_wrongAddress", "fail_wrongAddress",
@ -312,8 +312,8 @@ func (s *ManagerTestSuite) TestCreateChildAccount() {
"fail_keyStore", "fail_keyStore",
s.address, s.address,
s.password, s.password,
[]interface{}{nil, testErrKeyStore}, []interface{}{nil, errKeyStore},
testErrKeyStore, errKeyStore,
}, },
{ {
"fail_wrongAddress", "fail_wrongAddress",
@ -365,9 +365,9 @@ func (s *ManagerTestSuite) TestSelectedAndReSelectAccount() {
s.T().Run("ReSelect_fail_whisper", func(t *testing.T) { s.T().Run("ReSelect_fail_whisper", func(t *testing.T) {
s.reinitMock() s.reinitMock()
s.nodeManager.EXPECT().WhisperService().Return(nil, testErrWhisper).AnyTimes() s.nodeManager.EXPECT().WhisperService().Return(nil, errWhisper).AnyTimes()
err = s.accManager.ReSelectAccount() err = s.accManager.ReSelectAccount()
s.Equal(testErrWhisper, err) s.Equal(errWhisper, err)
}) })
s.accManager.selectedAccount = nil s.accManager.selectedAccount = nil
@ -391,9 +391,9 @@ func (s *ManagerTestSuite) TestLogout() {
err := s.accManager.Logout() err := s.accManager.Logout()
s.NoError(err) s.NoError(err)
s.nodeManager.EXPECT().WhisperService().Return(nil, testErrWhisper) s.nodeManager.EXPECT().WhisperService().Return(nil, errWhisper)
err = s.accManager.Logout() err = s.accManager.Logout()
s.Equal(testErrWhisper, err) s.Equal(errWhisper, err)
} }
// TestAccounts tests cases for (*Manager).Accounts. // TestAccounts tests cases for (*Manager).Accounts.
@ -411,9 +411,9 @@ func (s *ManagerTestSuite) TestAccounts() {
s.NotNil(accs) s.NotNil(accs)
// Can't get an account manager // Can't get an account manager
s.nodeManager.EXPECT().AccountManager().Return(nil, testErrAccManager) s.nodeManager.EXPECT().AccountManager().Return(nil, errAccManager)
_, err = s.accManager.Accounts() _, err = s.accManager.Accounts()
s.Equal(testErrAccManager, err) s.Equal(errAccManager, err)
// Selected account is nil but doesn't fail // Selected account is nil but doesn't fail
s.accManager.selectedAccount = nil s.accManager.selectedAccount = nil
@ -440,10 +440,10 @@ func (s *ManagerTestSuite) TestAddressToDecryptedAccount() {
}, },
{ {
"fail_keyStore", "fail_keyStore",
[]interface{}{nil, testErrKeyStore}, []interface{}{nil, errKeyStore},
s.address, s.address,
s.password, s.password,
testErrKeyStore, errKeyStore,
}, },
{ {
"fail_wrongAddress", "fail_wrongAddress",

View File

@ -411,7 +411,7 @@ type NotifyResult struct {
const passphraseEnvName = "ACCOUNT_PASSWORD" const passphraseEnvName = "ACCOUNT_PASSWORD"
// LoadTestConfig loads test configuration values from disk // LoadTestConfig loads test configuration values from disk
func LoadTestConfig(networkId int) (*TestConfig, error) { func LoadTestConfig(networkID int) (*TestConfig, error) {
var testConfig TestConfig var testConfig TestConfig
configData := static.MustAsset("config/test-data.json") configData := static.MustAsset("config/test-data.json")
@ -419,7 +419,7 @@ func LoadTestConfig(networkId int) (*TestConfig, error) {
return nil, err return nil, err
} }
if networkId == params.StatusChainNetworkID { if networkID == params.StatusChainNetworkID {
accountsData := static.MustAsset("config/status-chain-accounts.json") accountsData := static.MustAsset("config/status-chain-accounts.json")
if err := json.Unmarshal(accountsData, &testConfig); err != nil { if err := json.Unmarshal(accountsData, &testConfig); err != nil {
return nil, err return nil, err

View File

@ -18,7 +18,7 @@ func Write(fn otto.FunctionCall, w io.Writer, consoleEventName string) otto.Valu
}) })
// Next print out the giving values. // Next print out the giving values.
fmt.Fprintf(w, "%s: %s", consoleEventName, formatForConsole(fn.ArgumentList)) // nolint: gas fmt.Fprintf(w, "%s: %s", consoleEventName, formatForConsole(fn.ArgumentList))
return otto.UndefinedValue() return otto.UndefinedValue()
} }

View File

@ -8,6 +8,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )
// AddrLocker provides locks for addresses
type AddrLocker struct { type AddrLocker struct {
mu sync.Mutex mu sync.Mutex
locks map[common.Address]*sync.Mutex locks map[common.Address]*sync.Mutex

View File

@ -25,6 +25,7 @@ type EthTxClient struct {
c *rpc.Client c *rpc.Client
} }
// NewEthTxClient returns a new EthTxClient for client
func NewEthTxClient(client *rpc.Client) *EthTxClient { func NewEthTxClient(client *rpc.Client) *EthTxClient {
return &EthTxClient{c: client} return &EthTxClient{c: client}
} }

View File

@ -10,6 +10,7 @@ import (
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
) )
// NewTestServer returns a mocked test server
func NewTestServer(ctrl *gomock.Controller) (*rpc.Server, *MockFakePublicTransactionPoolAPI) { func NewTestServer(ctrl *gomock.Controller) (*rpc.Server, *MockFakePublicTransactionPoolAPI) {
srv := rpc.NewServer() srv := rpc.NewServer()
svc := NewMockFakePublicTransactionPoolAPI(ctrl) svc := NewMockFakePublicTransactionPoolAPI(ctrl)
@ -29,10 +30,10 @@ type CallArgs struct {
Data hexutil.Bytes `json:"data"` Data hexutil.Bytes `json:"data"`
} }
// FakePublicTransactionPoolAPI used to generate mock by mockgen util. // PublicTransactionPoolAPI used to generate mock by mockgen util.
// This was done because PublicTransactionPoolAPI is located in internal/ethapi module // This was done because PublicTransactionPoolAPI is located in internal/ethapi module
// and there is no easy way to generate mocks from internal modules. // and there is no easy way to generate mocks from internal modules.
type FakePublicTransactionPoolAPI interface { type PublicTransactionPoolAPI interface {
GasPrice(ctx context.Context) (*big.Int, error) GasPrice(ctx context.Context) (*big.Int, error)
EstimateGas(ctx context.Context, args CallArgs) (*hexutil.Big, error) EstimateGas(ctx context.Context, args CallArgs) (*hexutil.Big, error)
GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

View File

@ -1,64 +0,0 @@
LINT_EXCLUDE := --exclude='.*_mock.go' --exclude='geth/jail/doc.go'
LINT_FOLDERS := extkeys cmd/... geth/... e2e/...
LINT_FOLDERS_WITHOUT_TESTS := extkeys cmd/... geth/...
lint-install:
go get -u github.com/alecthomas/gometalinter
gometalinter --install
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:
@echo "lint-vet"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=vet --deadline=45s $(LINT_FOLDERS)
lint-golint:
@echo "lint-golint"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=golint --deadline=45s $(LINT_FOLDERS)
lint-gofmt:
@echo "lint-gofmt"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gofmt --deadline=45s $(LINT_FOLDERS)
lint-deadcode:
@echo "lint-deadcode"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=deadcode --deadline=45s $(LINT_FOLDERS)
lint-misspell:
@echo "lint-misspell"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=misspell --deadline=45s $(LINT_FOLDERS)
lint-unparam:
@echo "lint-unparam"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=unparam --deadline=45s $(LINT_FOLDERS)
lint-unused:
@echo "lint-unused"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=unused --deadline=45s $(LINT_FOLDERS)
lint-gocyclo:
@echo "lint-gocyclo"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gocyclo --cyclo-over=16 --deadline=45s $(LINT_FOLDERS)
lint-errcheck:
@echo "lint-errcheck"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=errcheck --deadline=1m $(LINT_FOLDERS)
lint-ineffassign:
@echo "lint-ineffassign"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=ineffassign --deadline=45s $(LINT_FOLDERS)
lint-interfacer:
@echo "lint-interfacer"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=interfacer --deadline=45s $(LINT_FOLDERS)
lint-unconvert:
@echo "lint-unconvert"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=unconvert --deadline=45s $(LINT_FOLDERS)
lint-staticcheck:
@echo "lint-staticcheck"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=staticcheck --deadline=45s $(LINT_FOLDERS)
lint-goconst:
@echo "lint-goconst"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=goconst --deadline=45s $(LINT_FOLDERS)
lint-gas:
@echo "lint-gas"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gas --deadline=45s $(LINT_FOLDERS)
lint-varcheck:
@echo "lint-varcheck"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=varcheck --deadline=45s $(LINT_FOLDERS)
lint-structcheck:
@echo "lint-structcheck"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=structcheck --deadline=45s $(LINT_FOLDERS)
lint-gosimple:
@echo "lint-gosimple"
@gometalinter $(LINT_EXCLUDE) --disable-all --enable=gosimple --deadline=45s $(LINT_FOLDERS)

View File

@ -194,9 +194,8 @@ func GetNetworkID() int {
func GetAccount1PKFile() string { func GetAccount1PKFile() string {
if GetNetworkID() == params.StatusChainNetworkID { if GetNetworkID() == params.StatusChainNetworkID {
return "test-account1-status-chain.pk" return "test-account1-status-chain.pk"
} else {
return "test-account1.pk"
} }
return "test-account1.pk"
} }
// GetAccount2PKFile returns the filename for Account2 keystore based // GetAccount2PKFile returns the filename for Account2 keystore based
@ -205,9 +204,8 @@ func GetAccount1PKFile() string {
func GetAccount2PKFile() string { func GetAccount2PKFile() string {
if GetNetworkID() == params.StatusChainNetworkID { if GetNetworkID() == params.StatusChainNetworkID {
return "test-account2-status-chain.pk" return "test-account2-status-chain.pk"
} else {
return "test-account2.pk"
} }
return "test-account2.pk"
} }
// WaitClosed used to wait on a channel in tests // WaitClosed used to wait on a channel in tests