lint: cleanup pending lint errors (#7237)

This commit is contained in:
Sam Kleinman
2021-11-04 13:08:55 +01:00
committed by GitHub
parent 61831cf5ef
commit 4ef140f6ca
35 changed files with 65 additions and 46 deletions

View File

@@ -43,7 +43,7 @@ func (bz *HexBytes) UnmarshalJSON(data []byte) error {
return nil
}
// Bytes fulfils various interfaces in light-client, etc...
// Bytes fulfills various interfaces in light-client, etc...
func (bz HexBytes) Bytes() []byte {
return bz
}

View File

@@ -13,7 +13,8 @@ func TestEventCache_Flush(t *testing.T) {
require.NoError(t, err)
err = evsw.AddListenerForEvent("nothingness", "", func(data EventData) {
// Check we are not initialising an empty buffer full of zeroed eventInfos in the EventCache
// Check we are not initializing an empty buffer full
// of zeroed eventInfos in the EventCache
require.FailNow(t, "We should never receive a message on this switch since none are fired")
})
require.NoError(t, err)

View File

@@ -61,7 +61,6 @@ func (c CustomValue) MarshalJSON() ([]byte, error) {
}
func (c CustomValue) UnmarshalJSON(bz []byte) error {
c.Value = "custom"
return nil
}

View File

@@ -71,7 +71,7 @@ func iotest(writer protoio.WriteCloser, reader protoio.ReadCloser) error {
return err
}
if n != len(bz)+visize {
return fmt.Errorf("WriteMsg() wrote %v bytes, expected %v", n, len(bz)+visize) // nolint
return fmt.Errorf("WriteMsg() wrote %v bytes, expected %v", n, len(bz)+visize)
}
lens[i] = n
}

View File

@@ -23,16 +23,16 @@ var (
type Subscription struct {
out chan Message
cancelled chan struct{}
mtx tmsync.RWMutex
err error
canceled chan struct{}
mtx tmsync.RWMutex
err error
}
// NewSubscription returns a new subscription with the given outCapacity.
func NewSubscription(outCapacity int) *Subscription {
return &Subscription{
out: make(chan Message, outCapacity),
cancelled: make(chan struct{}),
out: make(chan Message, outCapacity),
canceled: make(chan struct{}),
}
}
@@ -43,13 +43,14 @@ func (s *Subscription) Out() <-chan Message {
return s.out
}
// nolint: misspell
// Cancelled returns a channel that's closed when the subscription is
// terminated and supposed to be used in a select statement.
func (s *Subscription) Cancelled() <-chan struct{} {
return s.cancelled
return s.canceled
}
// Err returns nil if the channel returned by Cancelled is not yet closed.
// Err returns nil if the channel returned is not yet closed.
// If the channel is closed, Err returns a non-nil error explaining why:
// - ErrUnsubscribed if the subscriber choose to unsubscribe,
// - ErrOutOfCapacity if the subscriber is not pulling messages fast enough
@@ -66,7 +67,7 @@ func (s *Subscription) cancel(err error) {
s.mtx.Lock()
s.err = err
s.mtx.Unlock()
close(s.cancelled)
close(s.canceled)
}
// Message glues data and events together.

View File

@@ -1,3 +1,4 @@
//go:build deadlock
// +build deadlock
package sync

View File

@@ -1,3 +1,4 @@
//go:build !deadlock
// +build !deadlock
package sync