diff --git a/pilot/pkg/model/push_context.go b/pilot/pkg/model/push_context.go index 209e359bbc93..f9d55ae609e9 100644 --- a/pilot/pkg/model/push_context.go +++ b/pilot/pkg/model/push_context.go @@ -1678,9 +1678,10 @@ func (ps *PushContext) initSidecarScopes(env *Environment, wp *PushContextWorker go func() { for i := 0; i < n; i++ { + j := i work := func() { defer wg.Done() - c := sidecarConfigs[i] + c := sidecarConfigs[j] ch <- ConvertToSidecarScope(ps, &c, c.Namespace) } wp.PushWork(work)