mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-02 13:42:15 +02:00
multi: don't access loop variables in goroutines
This commit makes sure that no loop variables or other temporary variables are accessed directly in a goroutine but are instead passed into the goroutine through a parameter. This makes sure a copy of the value is put on the stack and is not changed while the outside loop continues.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user