Avoid using loop variable in test tasks
This commit is contained in:
parent
2b5b39e7b5
commit
e476e8570a
1 changed files with 4 additions and 2 deletions
|
@ -94,7 +94,8 @@ func TestPriorityPool_Submit(t *testing.T) {
|
|||
wg.Add(poolCap)
|
||||
|
||||
for i := 0; i < poolCap; i++ {
|
||||
err = p.Submit(lowPriority, taskGenerator(i, nil, wg))
|
||||
id := i
|
||||
err = p.Submit(lowPriority, taskGenerator(id, nil, wg))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
@ -114,7 +115,8 @@ func TestPriorityPool_Submit(t *testing.T) {
|
|||
wg.Add(n)
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
err = p.Submit(lowPriority, taskGenerator(i, nil, wg))
|
||||
id := i
|
||||
err = p.Submit(lowPriority, taskGenerator(id, nil, wg))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue