semaphore: avoid loop variable capture by closure
Change-Id: I21c5dc48ffe43aa27c50a42f9c9a01ac1f0c747c Reviewed-on: https://go-review.googlesource.com/40991 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Glenn Lewis <gmlewis@google.com>
This commit is contained in:
parent
5a06fca2c3
commit
de49d9dcd2
1 changed files with 1 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ func TestWeighted(t *testing.T) {
|
|||
var wg sync.WaitGroup
|
||||
wg.Add(n)
|
||||
for i := 0; i < n; i++ {
|
||||
i := i
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
HammerWeighted(sem, int64(i), 1000)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue