Browse Source

fix new linting errors

pull/703/head
Zach Ramsay 7 years ago
committed by Ethan Buchman
parent
commit
6f3c05545d
6 changed files with 32 additions and 27 deletions
  1. +1
    -1
      Makefile
  2. +1
    -1
      consensus/wal.go
  3. +1
    -1
      lite/files/provider.go
  4. +28
    -22
      rpc/lib/rpc_test.go
  5. +1
    -1
      state/txindex/indexer.go
  6. +0
    -1
      state/txindex/kv/kv.go

+ 1
- 1
Makefile View File

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


+ 1
- 1
consensus/wal.go View File

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


+ 1
- 1
lite/files/provider.go View File

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


+ 28
- 22
rpc/lib/rpc_test.go View File

@ -216,19 +216,17 @@ func echoViaWS(cl *client.WSClient, val string) (string, error) {
return "", err
}
select {
case msg := <-cl.ResponsesCh:
if msg.Error != nil {
return "", err
msg := <-cl.ResponsesCh
if msg.Error != nil {
return "", err
}
result := new(ResultEcho)
err = json.Unmarshal(msg.Result, result)
if err != nil {
return "", nil
}
return result.Value, nil
}
result := new(ResultEcho)
err = json.Unmarshal(msg.Result, result)
if err != nil {
return "", nil
}
return result.Value, nil
}
func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) {
@ -240,19 +238,17 @@ func echoBytesViaWS(cl *client.WSClient, bytes []byte) ([]byte, error) {
return []byte{}, err
}
select {
case msg := <-cl.ResponsesCh:
if msg.Error != nil {
return []byte{}, msg.Error
msg := <-cl.ResponsesCh
if msg.Error != nil {
return []byte{}, msg.Error
}
result := new(ResultEchoBytes)
err = json.Unmarshal(msg.Result, result)
if err != nil {
return []byte{}, nil
}
return result.Value, nil
}
result := new(ResultEchoBytes)
err = json.Unmarshal(msg.Result, result)
if err != nil {
return []byte{}, nil
}
return result.Value, nil
}
func testWithWSClient(t *testing.T, cl *client.WSClient) {
@ -333,6 +329,11 @@ func TestWSNewWSRPCFunc(t *testing.T) {
got := result.Value
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) {
@ -358,6 +359,11 @@ func TestWSHandlesArrayParams(t *testing.T) {
got := result.Value
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


+ 1
- 1
state/txindex/indexer.go View File

@ -11,7 +11,7 @@ type TxIndexer interface {
// AddBatch analyzes, indexes or stores a batch of transactions.
// 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.
AddBatch(b *Batch) error


+ 0
- 1
state/txindex/kv/kv.go View File

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


Loading…
Cancel
Save