Skip to content

Commit a8421ad

Browse files
authored
fix(tabwriter): update for loop (scaleway#4406)
1 parent d03f829 commit a8421ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/tabwriter/tabwriter_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ func BenchmarkTable(b *testing.B) {
700700
b.Run(fmt.Sprintf("%dx%d", w, h), func(b *testing.B) {
701701
b.Run("new", func(b *testing.B) {
702702
b.ReportAllocs()
703-
for i := 0; i < b.N; i++ {
703+
for range b.N {
704704
w := tabwriter.NewWriter(io.Discard, 4, 4, 1, ' ', 0) // no particular reason for these settings
705705
// Write the line h times.
706706
for range h {
@@ -713,7 +713,7 @@ func BenchmarkTable(b *testing.B) {
713713
b.Run("reuse", func(b *testing.B) {
714714
b.ReportAllocs()
715715
w := tabwriter.NewWriter(io.Discard, 4, 4, 1, ' ', 0) // no particular reason for these settings
716-
for i := 0; i < b.N; i++ {
716+
for range b.N {
717717
// Write the line h times.
718718
for range h {
719719
w.Write(line)
@@ -732,7 +732,7 @@ func BenchmarkPyramid(b *testing.B) {
732732
line := bytes.Repeat([]byte("a\t"), x)
733733
b.Run(strconv.Itoa(x), func(b *testing.B) {
734734
b.ReportAllocs()
735-
for i := 0; i < b.N; i++ {
735+
for range b.N {
736736
w := tabwriter.NewWriter(io.Discard, 4, 4, 1, ' ', 0) // no particular reason for these settings
737737
// Write increasing prefixes of that line.
738738
for j := range x {
@@ -754,7 +754,7 @@ func BenchmarkRagged(b *testing.B) {
754754
for _, h := range [...]int{10, 100, 1000} {
755755
b.Run(strconv.Itoa(h), func(b *testing.B) {
756756
b.ReportAllocs()
757-
for i := 0; i < b.N; i++ {
757+
for range b.N {
758758
w := tabwriter.NewWriter(io.Discard, 4, 4, 1, ' ', 0) // no particular reason for these settings
759759
// Write the lines in turn h times.
760760
for j := range h {
@@ -782,7 +782,7 @@ lines
782782

783783
func BenchmarkCode(b *testing.B) {
784784
b.ReportAllocs()
785-
for i := 0; i < b.N; i++ {
785+
for range b.N {
786786
w := tabwriter.NewWriter(io.Discard, 4, 4, 1, ' ', 0) // no particular reason for these settings
787787
// The code is small, so it's reasonable for the tabwriter user
788788
// to write it all at once, or buffer the writes.

0 commit comments

Comments
 (0)