fix(datarace): pass peer var as param for func literal

peer var was being accessed by scope heritage instead of being passed as param.
making it unsafe to data race.
This commit is contained in:
Tommy PAGEARD 2020-07-06 18:53:29 +02:00
parent 121623bc02
commit b543958475

View File

@ -273,10 +273,10 @@ func (g *Group) Remove(ctx context.Context, key string) error {
}
wg.Add(1)
go func() {
go func(peer ProtoGetter) {
errs <- g.removeFromPeer(ctx, peer, key)
wg.Done()
}()
}(peer)
}
go func() {
wg.Wait()