diff --git a/chainntnfs/bitcoindnotify/bitcoind.go b/chainntnfs/bitcoindnotify/bitcoind.go index 424291351..680d7c7d0 100644 --- a/chainntnfs/bitcoindnotify/bitcoind.go +++ b/chainntnfs/bitcoindnotify/bitcoind.go @@ -235,7 +235,9 @@ out: // // TODO(wilmer): add retry logic if rescan fails? b.wg.Add(1) - go func() { + + //nolint:lll + go func(msg *chainntnfs.HistoricalConfDispatch) { defer b.wg.Done() confDetails, _, err := b.historicalConfDetails( @@ -269,7 +271,7 @@ out: "details of %v: %v", msg.ConfRequest, err) } - }() + }(msg) case *chainntnfs.HistoricalSpendDispatch: // In order to ensure we don't block the caller @@ -278,7 +280,9 @@ out: // // TODO(wilmer): add retry logic if rescan fails? b.wg.Add(1) - go func() { + + //nolint:lll + go func(msg *chainntnfs.HistoricalSpendDispatch) { defer b.wg.Done() spendDetails, err := b.historicalSpendDetails( @@ -320,7 +324,7 @@ out: "details of %v: %v", msg.SpendRequest, err) } - }() + }(msg) case *blockEpochRegistration: chainntnfs.Log.Infof("New block epoch subscription") diff --git a/chainntnfs/btcdnotify/btcd.go b/chainntnfs/btcdnotify/btcd.go index 2ced59754..5dfb82346 100644 --- a/chainntnfs/btcdnotify/btcd.go +++ b/chainntnfs/btcdnotify/btcd.go @@ -347,7 +347,9 @@ out: // // TODO(wilmer): add retry logic if rescan fails? b.wg.Add(1) - go func() { + + //nolint:lll + go func(msg *chainntnfs.HistoricalConfDispatch) { defer b.wg.Done() confDetails, _, err := b.historicalConfDetails( @@ -372,7 +374,7 @@ out: if err != nil { chainntnfs.Log.Error(err) } - }() + }(msg) case *blockEpochRegistration: chainntnfs.Log.Infof("New block epoch subscription") diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index 96d5b6f8a..6f8f9717c 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -432,7 +432,9 @@ func (n *NeutrinoNotifier) notificationDispatcher() { // chain asynchronously to prevent blocking // potentially long rescans. n.wg.Add(1) - go func() { + + //nolint:lll + go func(msg *chainntnfs.HistoricalConfDispatch) { defer n.wg.Done() confDetails, err := n.historicalConfDetails( @@ -457,7 +459,7 @@ func (n *NeutrinoNotifier) notificationDispatcher() { if err != nil { chainntnfs.Log.Error(err) } - }() + }(msg) case *blockEpochRegistration: chainntnfs.Log.Infof("New block epoch subscription") diff --git a/healthcheck/healthcheck.go b/healthcheck/healthcheck.go index 5244eb888..e314f8d19 100644 --- a/healthcheck/healthcheck.go +++ b/healthcheck/healthcheck.go @@ -71,10 +71,11 @@ func (m *Monitor) Start() error { } m.wg.Add(1) - go func() { + go func(check *Observation) { defer m.wg.Done() + check.monitor(m.cfg.Shutdown, m.quit) - }() + }(check) } return nil diff --git a/lntest/itest/utils.go b/lntest/itest/utils.go index abeac91db..c2539b73b 100644 --- a/lntest/itest/utils.go +++ b/lntest/itest/utils.go @@ -78,13 +78,12 @@ func completePaymentRequests(client lnrpc.LightningClient, // Launch all payments simultaneously. results := make(chan error) for _, payReq := range paymentRequests { - payReqCopy := payReq - go func() { - err := send(payReqCopy) + go func(payReq string) { + err := send(payReq) if awaitResponse { results <- err } - }() + }(payReq) } // If awaiting a response, verify that all payments succeeded. diff --git a/lnwallet/btcwallet/btcwallet.go b/lnwallet/btcwallet/btcwallet.go index eca08eb37..ad32da0cf 100644 --- a/lnwallet/btcwallet/btcwallet.go +++ b/lnwallet/btcwallet/btcwallet.go @@ -1483,9 +1483,13 @@ out: // Launch a goroutine to re-package and send // notifications for any newly confirmed transactions. - go func() { + //nolint:lll + go func(txNtfn *wallet.TransactionNotifications) { for _, block := range txNtfn.AttachedBlocks { - details, err := minedTransactionsToDetails(currentHeight, block, t.w.ChainParams()) + details, err := minedTransactionsToDetails( + currentHeight, block, + t.w.ChainParams(), + ) if err != nil { continue } @@ -1499,11 +1503,11 @@ out: } } - }() + }(txNtfn) // Launch a goroutine to re-package and send // notifications for any newly unconfirmed transactions. - go func() { + go func(txNtfn *wallet.TransactionNotifications) { for _, tx := range txNtfn.UnminedTransactions { detail, err := unminedTransactionsToDetail( tx, t.w.ChainParams(), @@ -1518,7 +1522,7 @@ out: return } } - }() + }(txNtfn) case <-t.quit: break out } diff --git a/rpcserver.go b/rpcserver.go index 09ba7dae8..847e9564c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -5214,7 +5214,7 @@ sendLoop: // payment so we can continue to serve requests while // this payment is being dispatched. wg.Add(1) - go func() { + go func(payIntent *rpcPaymentIntent) { defer wg.Done() // Attempt to grab a free semaphore slot, using @@ -5292,7 +5292,7 @@ sendLoop: } return } - }() + }(payIntent) } }