multi: improve readability of goroutine defers

This commit fixes the readability of some of the defer calls in
goroutines by making sure the defer stands out properly.
This commit is contained in:
Oliver Gugger 2022-11-21 13:07:56 +01:00
parent ad8e25cbc9
commit 55b53555e9
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
8 changed files with 10 additions and 1 deletions

View File

@ -1325,6 +1325,7 @@ func (d *AuthenticatedGossiper) networkHandler() {
d.wg.Add(1)
go func() {
defer d.wg.Done()
log.Infof("Broadcasting %v new announcements in %d sub batches",
len(announcementBatch), len(splitAnnouncementBatch))
@ -2947,6 +2948,7 @@ func (d *AuthenticatedGossiper) handleAnnSig(nMsg *networkMsg,
d.wg.Add(1)
go func() {
defer d.wg.Done()
log.Debugf("Received half proof for channel "+
"%v with existing full proof. Sending"+
" full proof to peer=%x",

View File

@ -1969,6 +1969,7 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
f.wg.Add(1)
go func() {
defer f.wg.Done()
f.waitForPsbt(psbtIntent, resCtx, pendingChanID)
}()

View File

@ -1742,6 +1742,7 @@ func (s *Switch) htlcForwarder() {
wg.Add(1)
go func(l ChannelLink) {
defer wg.Done()
l.Stop()
}(link)
}

View File

@ -405,6 +405,7 @@ func subscribeChannelNotifications(ctxb context.Context, t *harnessTest,
chanUpdates := make(chan *lnrpc.ChannelEventUpdate, 20)
go func() {
defer cancelFunc()
for {
select {
case <-quit:

View File

@ -180,8 +180,9 @@ func (h *MiddlewareHandler) Run() error {
// request to the client).
h.wg.Add(1)
go func() {
defer h.wg.Done()
h.receiveResponses(errChan, responses)
h.wg.Done()
}()
return h.sendInterceptRequests(errChan, responses)

View File

@ -1415,6 +1415,7 @@ func (s *UtxoSweeper) waitForSpend(outpoint wire.OutPoint,
s.wg.Add(1)
go func() {
defer s.wg.Done()
select {
case spend, ok := <-spendEvent.Spend:
if !ok {

View File

@ -39,6 +39,7 @@ func NewForce(interval time.Duration) *Force {
m.wg.Add(1)
go func() {
defer m.wg.Done()
for {
select {
case t := <-m.ticker:

View File

@ -689,6 +689,7 @@ func (s *sessionQueueSet) ApplyAndWait(getApply func(*sessionQueue) func()) {
wg.Add(1)
go func(sq *sessionQueue) {
defer wg.Done()
getApply(sq)()
}(sessionq)
}