lint: golint issue fixes (#4258)

* lint: golint issue fixes

- on my local machine golint is a lot stricter than the bot so slowly going through and fixing things.

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* more fixes from golint

* remove isPeerPersistentFn

* add changelog entry
This commit is contained in:
Marko
2019-12-17 13:02:45 +01:00
committed by GitHub
parent f0777277ad
commit 9bd0f9e634
56 changed files with 246 additions and 246 deletions

View File

@@ -22,7 +22,7 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
mempl "github.com/tendermint/tendermint/mempool"
"github.com/tendermint/tendermint/mock"
"github.com/tendermint/tendermint/privval"
@@ -912,11 +912,11 @@ func (app *badApp) Commit() abci.ResponseCommit {
app.height++
if app.onlyLastHashIsWrong {
if app.height == app.numBlocks {
return abci.ResponseCommit{Data: rand.RandBytes(8)}
return abci.ResponseCommit{Data: tmrand.Bytes(8)}
}
return abci.ResponseCommit{Data: []byte{app.height}}
} else if app.allHashesAreWrong {
return abci.ResponseCommit{Data: rand.RandBytes(8)}
return abci.ResponseCommit{Data: tmrand.Bytes(8)}
}
panic("either allHashesAreWrong or onlyLastHashIsWrong must be set")

View File

@@ -13,7 +13,7 @@ import (
cstypes "github.com/tendermint/tendermint/consensus/types"
"github.com/tendermint/tendermint/libs/log"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
p2pmock "github.com/tendermint/tendermint/p2p/mock"
"github.com/tendermint/tendermint/types"
)
@@ -1563,7 +1563,7 @@ func TestStateOutputsBlockPartsStats(t *testing.T) {
peer := p2pmock.NewPeer(nil)
// 1) new block part
parts := types.NewPartSetFromData(rand.RandBytes(100), 10)
parts := types.NewPartSetFromData(tmrand.Bytes(100), 10)
msg := &BlockPartMessage{
Height: 1,
Round: 0,

View File

@@ -6,7 +6,7 @@ import (
amino "github.com/tendermint/go-amino"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
@@ -19,16 +19,16 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
vset, _ := types.RandValidatorSet(nval, 1)
commitSigs := make([]types.CommitSig, nval)
blockID := types.BlockID{
Hash: rand.RandBytes(tmhash.Size),
Hash: tmrand.Bytes(tmhash.Size),
PartsHeader: types.PartSetHeader{
Hash: rand.RandBytes(tmhash.Size),
Hash: tmrand.Bytes(tmhash.Size),
Total: 1000,
},
}
sig := make([]byte, ed25519.SignatureSize)
for i := 0; i < nval; i++ {
commitSigs[i] = (&types.Vote{
ValidatorAddress: types.Address(rand.RandBytes(20)),
ValidatorAddress: types.Address(tmrand.Bytes(20)),
Timestamp: tmtime.Now(),
BlockID: blockID,
Signature: sig,
@@ -36,21 +36,21 @@ func BenchmarkRoundStateDeepCopy(b *testing.B) {
}
txs := make([]types.Tx, ntxs)
for i := 0; i < ntxs; i++ {
txs[i] = rand.RandBytes(100)
txs[i] = tmrand.Bytes(100)
}
// Random block
block := &types.Block{
Header: types.Header{
ChainID: rand.RandStr(12),
ChainID: tmrand.Str(12),
Time: tmtime.Now(),
LastBlockID: blockID,
LastCommitHash: rand.RandBytes(20),
DataHash: rand.RandBytes(20),
ValidatorsHash: rand.RandBytes(20),
ConsensusHash: rand.RandBytes(20),
AppHash: rand.RandBytes(20),
LastResultsHash: rand.RandBytes(20),
EvidenceHash: rand.RandBytes(20),
LastCommitHash: tmrand.Bytes(20),
DataHash: tmrand.Bytes(20),
ValidatorsHash: tmrand.Bytes(20),
ConsensusHash: tmrand.Bytes(20),
AppHash: tmrand.Bytes(20),
LastResultsHash: tmrand.Bytes(20),
EvidenceHash: tmrand.Bytes(20),
},
Data: types.Data{
Txs: txs,

View File

@@ -14,7 +14,7 @@ import (
"github.com/tendermint/tendermint/abci/example/kvstore"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/libs/rand"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/mock"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/proxy"
@@ -120,7 +120,7 @@ func WALWithNBlocks(t *testing.T, numBlocks int) (data []byte, err error) {
func randPort() int {
// returns between base and base + spread
base, spread := 20000, 20000
return base + rand.RandIntn(spread)
return base + tmrand.Intn(spread)
}
func makeAddrs() (string, string, string) {