linters: modify code to pass maligned and interfacer (#3959)

* Fix maligned structs

* Fix interfacer errors

* Revert accidental go.mod and go.sum changes

* Revert P2PConfig struct maligned reorder

* Revert PeerRoundState struct maligned reordering

* Revert RoundState struct maligned reordering

* Reorder WSClient struct

* Revert accidental type change

* Clean up type change

* Clean up type changes

* Revert to types.ABCIApplicationServer in GRPCServer struct

* Revert maligned changes to BaseConfig struct

* Fix tests in io_test.go

* Fix client_test package tests

* Fix reactor tests in consensus package

* Fix new interfacer errors
This commit is contained in:
Phil Salant
2019-09-30 17:12:51 -07:00
committed by Anton Kaliaev
parent 68f8fba7c2
commit 05075ea5b7
25 changed files with 128 additions and 127 deletions
+2 -2
View File
@@ -262,7 +262,7 @@ func genEphKeys() (ephPub, ephPriv *[32]byte) {
return
}
func shareEphPubKey(conn io.ReadWriteCloser, locEphPub *[32]byte) (remEphPub *[32]byte, err error) {
func shareEphPubKey(conn io.ReadWriter, locEphPub *[32]byte) (remEphPub *[32]byte, err error) {
// Send our pubkey and receive theirs in tandem.
var trs, _ = cmn.Parallel(
@@ -416,7 +416,7 @@ type authSigMessage struct {
Sig []byte
}
func shareAuthSignature(sc *SecretConnection, pubKey crypto.PubKey, signature []byte) (recvMsg authSigMessage, err error) {
func shareAuthSignature(sc io.ReadWriter, pubKey crypto.PubKey, signature []byte) (recvMsg authSigMessage, err error) {
// Send our info and receive theirs in tandem.
var trs, _ = cmn.Parallel(
+2 -3
View File
@@ -7,7 +7,6 @@ import (
"fmt"
"io"
"log"
"net"
"os"
"path/filepath"
"strconv"
@@ -189,7 +188,7 @@ func TestConcurrentRead(t *testing.T) {
}
}
func writeLots(t *testing.T, wg *sync.WaitGroup, conn net.Conn, txt string, n int) {
func writeLots(t *testing.T, wg *sync.WaitGroup, conn io.Writer, txt string, n int) {
defer wg.Done()
for i := 0; i < n; i++ {
_, err := conn.Write([]byte(txt))
@@ -200,7 +199,7 @@ func writeLots(t *testing.T, wg *sync.WaitGroup, conn net.Conn, txt string, n in
}
}
func readLots(t *testing.T, wg *sync.WaitGroup, conn net.Conn, n int) {
func readLots(t *testing.T, wg *sync.WaitGroup, conn io.Reader, n int) {
readBuffer := make([]byte, dataMaxSize)
for i := 0; i < n; i++ {
_, err := conn.Read(readBuffer)
+5 -5
View File
@@ -79,11 +79,6 @@ var _ AddrBook = (*addrBook)(nil)
type addrBook struct {
cmn.BaseService
// immutable after creation
filePath string
routabilityStrict bool
key string // random prefix for bucket placement
// accessed concurrently
mtx sync.Mutex
rand *cmn.Rand
@@ -95,6 +90,11 @@ type addrBook struct {
nOld int
nNew int
// immutable after creation
filePath string
key string // random prefix for bucket placement
routabilityStrict bool
wg sync.WaitGroup
}
+2 -2
View File
@@ -11,11 +11,11 @@ import (
type knownAddress struct {
Addr *p2p.NetAddress `json:"addr"`
Src *p2p.NetAddress `json:"src"`
Buckets []int `json:"buckets"`
Attempts int32 `json:"attempts"`
BucketType byte `json:"bucket_type"`
LastAttempt time.Time `json:"last_attempt"`
LastSuccess time.Time `json:"last_success"`
BucketType byte `json:"bucket_type"`
Buckets []int `json:"buckets"`
}
func newKnownAddress(addr *p2p.NetAddress, src *p2p.NetAddress) *knownAddress {