diff --git a/eacl/test/benchmark_test.go b/eacl/test/benchmark_test.go index b52653cb..d396f127 100644 --- a/eacl/test/benchmark_test.go +++ b/eacl/test/benchmark_test.go @@ -17,7 +17,7 @@ func baseBenchmarkTableBinaryComparison(b *testing.B, factor int) { b.StopTimer() b.ResetTimer() b.StartTimer() - for i := 0; i < b.N; i++ { + for range b.N { if !bytes.Equal(exp, t.Marshal()) { b.Fail() } @@ -33,7 +33,7 @@ func baseBenchmarkTableEqualsComparison(b *testing.B, factor int) { b.StopTimer() b.ResetTimer() b.StartTimer() - for i := 0; i < b.N; i++ { + for range b.N { if !eacl.EqualTables(*t, t2) { b.Fail() } @@ -71,7 +71,7 @@ func TargetN(n int) *eacl.Target { x.SetRole(eacl.RoleSystem) keys := make([][]byte, n) - for i := 0; i < n; i++ { + for i := range n { keys[i] = make([]byte, 32) //nolint:staticcheck rand.Read(keys[i]) @@ -85,7 +85,7 @@ func TargetN(n int) *eacl.Target { // Record returns random eacl.Record. func RecordN(n int) *eacl.Record { fs := make([]eacl.Filter, n) - for i := 0; i < n; i++ { + for i := range n { fs[i] = eacl.ConstructFilter(eacl.HeaderFromObject, "", eacl.MatchStringEqual, cidtest.ID().EncodeToString()) } @@ -95,7 +95,7 @@ func RecordN(n int) *eacl.Record { func TableN(n int) *eacl.Table { rs := make([]eacl.Record, n) - for i := 0; i < n; i++ { + for i := range n { rs[i] = *RecordN(n) } x := eacl.NewTableForContainer(cidtest.ID(), rs) diff --git a/pool/pool_aio_test.go b/pool/pool_aio_test.go index b0e19287..66a0d3fd 100644 --- a/pool/pool_aio_test.go +++ b/pool/pool_aio_test.go @@ -370,7 +370,7 @@ func testPoolInterfaceWithAIO(t *testing.T, nodeAddr string) { }) times := int(opts.sessionExpirationDuration * 3) - for i := 0; i < times; i++ { + for range times { epoch, err := tickNewEpoch(ctx, pool) require.NoError(t, err) diff --git a/pool/pool_test.go b/pool/pool_test.go index 58644f39..4393aabc 100644 --- a/pool/pool_test.go +++ b/pool/pool_test.go @@ -205,7 +205,7 @@ func TestOneOfTwoFailed(t *testing.T) { time.Sleep(2 * time.Second) - for i := 0; i < 5; i++ { + for range 5 { cp, err := pool.connection() require.NoError(t, err) require.True(t, assertAuthKeyForAny(cp.address(), nodes)) @@ -460,7 +460,7 @@ func TestStatusMonitor(t *testing.T) { monitor.errorThreshold = 3 count := 10 - for i := 0; i < count; i++ { + for range count { monitor.incErrorRate() } diff --git a/pool/sampler_test.go b/pool/sampler_test.go index 6cd5a5ed..63d9d541 100644 --- a/pool/sampler_test.go +++ b/pool/sampler_test.go @@ -34,7 +34,7 @@ func TestSamplerStability(t *testing.T) { for _, tc := range cases { sampler := newSampler(tc.probabilities, rand.NewSource(0)) res := make([]int, len(tc.probabilities)) - for i := 0; i < COUNT; i++ { + for range COUNT { res[sampler.Next()]++ } diff --git a/stat/pool_test.go b/stat/pool_test.go index 4f3f7757..261be7fd 100644 --- a/stat/pool_test.go +++ b/stat/pool_test.go @@ -46,7 +46,7 @@ func TestStatisticConcurrency(t *testing.T) { go func(c *config) { defer wg.Done() - for i := 0; i < n; i++ { + for range n { var err error if rand.N(2) > 0 { err = errors.New("some err")