Skip to content

Commit

Permalink
[patch] pass the loop variable to anonymous function
Browse files Browse the repository at this point in the history
  • Loading branch information
bnkamalesh committed Jan 23, 2025
1 parent 18ffe00 commit 6a5fd23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/depprober/depprober.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func ProbeDependencies(
healthOK := proberesponder.HealthOK.String()
healthNotOK := proberesponder.HealthNotOK.String()

for _, pinger := range probers {
go func() {
for i := range probers {
go func(pinger Prober) {
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
hc := DependencyStatus{
Expand All @@ -88,7 +88,7 @@ func ProbeDependencies(
hc.Status = healthNotOK
}
statuses <- hc
}()
}(probers[i])
}

list := make([]DependencyStatus, 0, total)
Expand Down

0 comments on commit 6a5fd23

Please sign in to comment.