Update golangci-lint config and fix linting issues (#168)

* update golangci

* update golang lint yml and updated linting issues
This commit is contained in:
Austin Abell
2020-01-08 09:56:49 +13:00
committed by GitHub
parent b98685c46b
commit 51adade59f
11 changed files with 56 additions and 255 deletions
+2 -2
View File
@@ -279,7 +279,7 @@ func (e *PublicEthAPI) SendTransaction(args params.SendTxArgs) (common.Hash, err
intChainID, ok := new(big.Int).SetString(chainID, 10)
if !ok {
return common.Hash{}, fmt.Errorf(
fmt.Sprintf("Invalid chainID: %s, must be integer format", chainID))
fmt.Sprintf("invalid chainID: %s, must be integer format", chainID))
}
// Sign transaction
@@ -592,7 +592,7 @@ func bytesToEthTx(cliCtx context.CLIContext, bz []byte) (*types.EthereumTxMsg, e
err := cliCtx.Codec.UnmarshalBinaryLengthPrefixed(bz, &stdTx)
ethTx, ok := stdTx.(*types.EthereumTxMsg)
if !ok || err != nil {
return nil, fmt.Errorf("Invalid transaction type, must be an amino encoded Ethereum transaction")
return nil, fmt.Errorf("invalid transaction type, must be an amino encoded Ethereum transaction")
}
return ethTx, nil
}
+15 -16
View File
@@ -39,23 +39,22 @@ func (e *PublicFilterAPI) GetLogs(criteria filters.FilterCriteria) ([]*ethtypes.
results := e.getLogs()
logs := filterLogs(results, nil, nil, filter.addresses, filter.topics)
return logs, nil
} else {
// Convert the RPC block numbers into internal representations
begin := rpc.LatestBlockNumber.Int64()
if criteria.FromBlock != nil {
begin = criteria.FromBlock.Int64()
}
from := big.NewInt(begin)
end := rpc.LatestBlockNumber.Int64()
if criteria.ToBlock != nil {
end = criteria.ToBlock.Int64()
}
to := big.NewInt(end)
results := e.getLogs()
logs := filterLogs(results, from, to, criteria.Addresses, criteria.Topics)
return returnLogs(logs), nil
}
// Convert the RPC block numbers into internal representations
begin := rpc.LatestBlockNumber.Int64()
if criteria.FromBlock != nil {
begin = criteria.FromBlock.Int64()
}
from := big.NewInt(begin)
end := rpc.LatestBlockNumber.Int64()
if criteria.ToBlock != nil {
end = criteria.ToBlock.Int64()
}
to := big.NewInt(end)
results := e.getLogs()
logs := filterLogs(results, from, to, criteria.Addresses, criteria.Topics)
return returnLogs(logs), nil
}
func (e *PublicFilterAPI) getLogs() (results []*ethtypes.Log) {
+1 -2
View File
@@ -63,6 +63,7 @@ func call(method string, params []string) (*Response, error) {
return nil, err
}
/* #nosec */
res, err := http.Post(addr, "application/json", bytes.NewBuffer(req))
if err != nil {
return nil, err
@@ -122,7 +123,6 @@ func TestEth_blockNumber(t *testing.T) {
}
t.Logf("Got block number: %s\n", res.String())
}
func TestEth_GetBalance(t *testing.T) {
@@ -144,7 +144,6 @@ func TestEth_GetBalance(t *testing.T) {
if res.ToInt().Cmp(big.NewInt(0)) != 0 {
t.Errorf("expected balance: %d, got: %s", 0, res.String())
}
}
func TestEth_GetStorageAt(t *testing.T) {
+1 -1
View File
@@ -49,7 +49,7 @@ func (bn *BlockNumber) UnmarshalJSON(data []byte) error {
return err
}
if blckNum > math.MaxInt64 {
return fmt.Errorf("Blocknumber too high")
return fmt.Errorf("blocknumber too high")
}
*bn = BlockNumber(blckNum)