From e476e8570ab2fb5ebef79a413ff43de9ddc89324 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Sun, 29 May 2022 14:27:10 +0300 Subject: [PATCH] Avoid using loop variable in test tasks --- pool_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pool_test.go b/pool_test.go index ad1c4b8..b9a55b9 100644 --- a/pool_test.go +++ b/pool_test.go @@ -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) }