@@ -117,40 +117,39 @@ func TestComputeGoroutineOffsets(t *testing.T) {
117117 }
118118
119119 for _ , testData := range tests {
120- test := testData // capture range variable
121- t .Run (test .name , func (t * testing.T ) {
120+ t .Run (testData .name , func (t * testing.T ) {
122121 // act
123122 result := internal .ComputeGoroutineOffsets (
124- test .inputTotalBytes ,
125- test .inputMaxGoroutines ,
126- test .inputMinBytesReadByAGoroutine ,
123+ testData .inputTotalBytes ,
124+ testData .inputMaxGoroutines ,
125+ testData .inputMinBytesReadByAGoroutine ,
127126 )
128127
129128 // assert
130- if ! reflect .DeepEqual (result , test .expectedResult ) {
131- t .Errorf ("expected %v, but got %v | %s" , test .expectedResult , result , test .name )
129+ if ! reflect .DeepEqual (result , testData .expectedResult ) {
130+ t .Errorf ("expected %v, but got %v | %s" , testData .expectedResult , result , testData .name )
132131 }
133132 })
134133 }
135134}
136135
137136func BenchmarkComputeGoroutineOffsets_1 (b * testing.B ) {
138137 b .ReportAllocs ()
139- for n := 0 ; n < b .N ; n ++ {
138+ for range b .N {
140139 _ = internal .ComputeGoroutineOffsets (1024 , 32 , 1 )
141140 }
142141}
143142
144143func BenchmarkComputeGoroutineOffsets_2 (b * testing.B ) {
145144 b .ReportAllocs ()
146- for n := 0 ; n < b .N ; n ++ {
145+ for range b .N {
147146 _ = internal .ComputeGoroutineOffsets (1024 , 32 , 1025 )
148147 }
149148}
150149
151150func BenchmarkComputeGoroutineOffsets_3 (b * testing.B ) {
152151 b .ReportAllocs ()
153- for n := 0 ; n < b .N ; n ++ {
152+ for range b .N {
154153 _ = internal .ComputeGoroutineOffsets (1024 , 32 , 1023 )
155154 }
156155}
0 commit comments