lint: cleanup pending lint errors (#7237)

This commit is contained in:
Sam Kleinman
2021-11-04 08:08:55 -04:00
committed by GitHub
parent 61831cf5ef
commit 4ef140f6ca
35 changed files with 65 additions and 46 deletions
+9 -8
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.