fix new linting errors

This commit is contained in:
Zach Ramsay
2017-10-26 19:24:18 -04:00
committed by Ethan Buchman
parent 414a8cb0ba
commit 6f3c05545d
6 changed files with 32 additions and 27 deletions

View File

@ -97,7 +97,7 @@ metalinter_test: ensure_tools
--enable=varcheck \ --enable=varcheck \
./... ./...
#--enable=aligncheck \ #--enable=maligned \
#--enable=dupl \ #--enable=dupl \
#--enable=errcheck \ #--enable=errcheck \
#--enable=goconst \ #--enable=goconst \

View File

@ -272,7 +272,7 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
} }
var nn int var nn int
var res *TimedWALMessage var res *TimedWALMessage // nolint: gosimple
res = wire.ReadBinary(&TimedWALMessage{}, bytes.NewBuffer(data), int(length), &nn, &err).(*TimedWALMessage) res = wire.ReadBinary(&TimedWALMessage{}, bytes.NewBuffer(data), int(length), &nn, &err).(*TimedWALMessage)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to decode data: %v", err) return nil, fmt.Errorf("failed to decode data: %v", err)

View File

@ -34,7 +34,7 @@ const (
ValDir = "validators" ValDir = "validators"
CheckDir = "checkpoints" CheckDir = "checkpoints"
dirPerm = os.FileMode(0755) dirPerm = os.FileMode(0755)
filePerm = os.FileMode(0644) //filePerm = os.FileMode(0644)
) )
type provider struct { type provider struct {

View File

@ -216,8 +216,7 @@ func echoViaWS(cl *client.WSClient, val string) (string, error) {
return "", err return "", err
} }
select { msg := <-cl.ResponsesCh
case msg := <-cl.ResponsesCh:
if msg.Error != nil { if msg.Error != nil {
return "", err return "", err
@ -228,7 +227,6 @@ func echoViaWS(cl *client.WSClient, val string) (string, error) {
return "", nil return "", nil
} }
return result.Value, nil return result.Value, nil
}
} }
func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) { func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) {
@ -240,8 +238,7 @@ func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) {
return []byte{}, err return []byte{}, err
} }
select { msg := <-cl.ResponsesCh
case msg := <-cl.ResponsesCh:
if msg.Error != nil { if msg.Error != nil {
return []byte{}, msg.Error return []byte{}, msg.Error
@ -252,7 +249,6 @@ func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) {
return []byte{}, nil return []byte{}, nil
} }
return result.Value, nil return result.Value, nil
}
} }
func testWithWSClient(t *testing.T, cl *client.WSClient) { func testWithWSClient(t *testing.T, cl *client.WSClient) {
@ -333,6 +329,11 @@ func TestWSNewWSRPCFunc(t *testing.T) {
got := result.Value got := result.Value
assert.Equal(t, got, val) assert.Equal(t, got, val)
} }
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
} }
func TestWSHandlesArrayParams(t *testing.T) { func TestWSHandlesArrayParams(t *testing.T) {
@ -358,6 +359,11 @@ func TestWSHandlesArrayParams(t *testing.T) {
got := result.Value got := result.Value
assert.Equal(t, got, val) assert.Equal(t, got, val)
} }
result := new(ResultEcho)
err = json.Unmarshal(*msg.Result, result)
require.Nil(t, err)
got := result.Value
assert.Equal(t, got, val)
} }
// TestWSClientPingPong checks that a client & server exchange pings // TestWSClientPingPong checks that a client & server exchange pings

View File

@ -11,7 +11,7 @@ type TxIndexer interface {
// AddBatch analyzes, indexes or stores a batch of transactions. // AddBatch analyzes, indexes or stores a batch of transactions.
// NOTE: We do not specify Index method for analyzing a single transaction // NOTE: We do not specify Index method for analyzing a single transaction
// here because it bears heavy perfomance loses. Almost all advanced indexers // here because it bears heavy performance losses. Almost all advanced indexers
// support batching. // support batching.
AddBatch(b *Batch) error AddBatch(b *Batch) error

View File

@ -10,7 +10,6 @@ import (
"github.com/tendermint/tendermint/state/txindex" "github.com/tendermint/tendermint/state/txindex"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
db "github.com/tendermint/tmlibs/db"
) )
// TxIndex is the simplest possible indexer, backed by Key-Value storage (levelDB). // TxIndex is the simplest possible indexer, backed by Key-Value storage (levelDB).