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
+1 -1
View File
@@ -418,7 +418,7 @@ func sumReceivedNumbers(numbers, doneSum chan uint64) {
// to `offset` + 999. It additionally returns the addition of all integers
// sent on `doneChan` for assertion that all events have been sent, and enabling
// the test to assert all events have also been received.
func fireEvents(evsw EventSwitch, event string, doneChan chan uint64,
func fireEvents(evsw Fireable, event string, doneChan chan uint64,
offset uint64) {
var sentSum uint64
for i := offset; i <= offset+uint64(999); i++ {
+3 -3
View File
@@ -108,9 +108,6 @@ const timeRemLimit = 999*time.Hour + 59*time.Minute + 59*time.Second
// per second rounded to the nearest byte.
type Status struct {
Active bool // Flag indicating an active transfer
Start time.Time // Transfer start time
Duration time.Duration // Time period covered by the statistics
Idle time.Duration // Time since the last transfer of at least 1 byte
Bytes int64 // Total number of bytes transferred
Samples int64 // Total number of samples taken
InstRate int64 // Instantaneous transfer rate
@@ -118,6 +115,9 @@ type Status struct {
AvgRate int64 // Average transfer rate (Bytes / Duration)
PeakRate int64 // Maximum instantaneous transfer rate
BytesRem int64 // Number of bytes remaining in the transfer
Start time.Time // Transfer start time
Duration time.Duration // Time period covered by the statistics
Idle time.Duration // Time since the last transfer of at least 1 byte
TimeRem time.Duration // Estimated time to completion
Progress Percent // Overall transfer progress
}
+10 -10
View File
@@ -79,14 +79,14 @@ func TestReader(t *testing.T) {
status[5] = nextStatus(r.Monitor) // Timeout
start = status[0].Start
// Active, Start, Duration, Idle, Bytes, Samples, InstRate, CurRate, AvgRate, PeakRate, BytesRem, TimeRem, Progress
// Active, Bytes, Samples, InstRate, CurRate, AvgRate, PeakRate, BytesRem, Start, Duration, Idle, TimeRem, Progress
want := []Status{
{true, start, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{true, start, _100ms, 0, 10, 1, 100, 100, 100, 100, 0, 0, 0},
{true, start, _200ms, _100ms, 20, 2, 100, 100, 100, 100, 0, 0, 0},
{true, start, _300ms, _200ms, 20, 3, 0, 90, 67, 100, 0, 0, 0},
{false, start, _300ms, 0, 20, 3, 0, 0, 67, 100, 0, 0, 0},
{false, start, _300ms, 0, 20, 3, 0, 0, 67, 100, 0, 0, 0},
{true, 0, 0, 0, 0, 0, 0, 0, start, 0, 0, 0, 0},
{true, 10, 1, 100, 100, 100, 100, 0, start, _100ms, 0, 0, 0},
{true, 20, 2, 100, 100, 100, 100, 0, start, _200ms, _100ms, 0, 0},
{true, 20, 3, 0, 90, 67, 100, 0, start, _300ms, _200ms, 0, 0},
{false, 20, 3, 0, 0, 67, 100, 0, start, _300ms, 0, 0, 0},
{false, 20, 3, 0, 0, 67, 100, 0, start, _300ms, 0, 0, 0},
}
for i, s := range status {
s := s
@@ -138,10 +138,10 @@ func TestWriter(t *testing.T) {
status := []Status{w.Status(), nextStatus(w.Monitor)}
start = status[0].Start
// Active, Start, Duration, Idle, Bytes, Samples, InstRate, CurRate, AvgRate, PeakRate, BytesRem, TimeRem, Progress
// Active, Bytes, Samples, InstRate, CurRate, AvgRate, PeakRate, BytesRem, Start, Duration, Idle, TimeRem, Progress
want := []Status{
{true, start, _400ms, 0, 80, 4, 200, 200, 200, 200, 20, _100ms, 80000},
{true, start, _500ms, _100ms, 100, 5, 200, 200, 200, 200, 0, 0, 100000},
{true, 80, 4, 200, 200, 200, 200, 20, start, _400ms, 0, _100ms, 80000},
{true, 100, 5, 200, 200, 200, 200, 0, start, _500ms, _100ms, 0, 100000},
}
for i, s := range status {
s := s