Skip to content

Commit 9a92938

Browse files
committed
all: run modernize happy
$ go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./... Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent 76c00e3 commit 9a92938

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Kamil Dziedzic <kamil at klecza.pl>
8080
Kei Kamikawa <x00.x7f.x86 at gmail.com>
8181
Kevin Malachowski <kevin at chowski.com>
8282
Kieron Woodhouse <kieron.woodhouse at infosum.com>
83+
Koichi Shiraishi <zchee.io at gmail.com>
8384
Lance Tian <lance6716 at gmail.com>
8485
Lennart Rudolph <lrudolph at hmc.edu>
8586
Leonardo YongUk Kim <dalinaum at gmail.com>

benchmark_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func benchmarkQuery(b *testing.B, compr bool) {
9292
defer wg.Wait()
9393
b.StartTimer()
9494

95-
for i := 0; i < concurrencyLevel; i++ {
95+
for range concurrencyLevel {
9696
go func() {
9797
for {
9898
if atomic.AddInt64(&remain, -1) < 0 {
@@ -129,7 +129,7 @@ func BenchmarkExec(b *testing.B) {
129129
b.ReportAllocs()
130130
b.ResetTimer()
131131

132-
for i := 0; i < concurrencyLevel; i++ {
132+
for range concurrencyLevel {
133133
go func() {
134134
for {
135135
if atomic.AddInt64(&remain, -1) < 0 {
@@ -345,7 +345,7 @@ func BenchmarkQueryRawBytes(b *testing.B) {
345345
for i := range blob {
346346
blob[i] = 42
347347
}
348-
for i := 0; i < 100; i++ {
348+
for i := range 100 {
349349
_, err := db.Exec("INSERT INTO bench_rawbytes VALUES (?, ?)", i, blob)
350350
if err != nil {
351351
b.Fatal(err)
@@ -404,7 +404,7 @@ func benchmark10kRows(b *testing.B, compress bool) {
404404
args[i] = sval
405405
}
406406
for i := 0; i < 10000; i += 100 {
407-
for j := 0; j < 100; j++ {
407+
for j := range 100 {
408408
args[j*2] = i + j
409409
}
410410
_, err := stmt.Exec(args...)
@@ -462,7 +462,7 @@ func BenchmarkReceiveMetadata(b *testing.B) {
462462

463463
// Create a table with 1000 integer fields
464464
createTableQuery := "CREATE TABLE large_integer_table ("
465-
for i := 0; i < 1000; i++ {
465+
for i := range 1000 {
466466
createTableQuery += fmt.Sprintf("col_%d INT", i)
467467
if i < 999 {
468468
createTableQuery += ", "

driver_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func runTests(t *testing.T, dsn string, tests ...func(dbt *DBTest)) {
176176
cleanupSql := "DROP TABLE IF EXISTS test"
177177

178178
for _, test := range tests {
179-
test := test
180179
t.Run("default", func(t *testing.T) {
181180
dbt := &DBTest{t, db}
182181
t.Cleanup(func() {
@@ -220,8 +219,6 @@ func runTestsParallel(t *testing.T, dsn string, tests ...func(dbt *DBTest, table
220219

221220
t.Parallel()
222221
for _, test := range tests {
223-
test := test
224-
225222
t.Run("default", func(t *testing.T) {
226223
t.Parallel()
227224

@@ -491,7 +488,6 @@ func TestMultiQuery(t *testing.T) {
491488
dbt.Error("no data")
492489
}
493490
rows.Close()
494-
495491
})
496492
}
497493

@@ -3071,7 +3067,7 @@ func TestRowsColumnTypes(t *testing.T) {
30713067
bx0 := []byte("\x00")
30723068
bx42 := []byte("\x42")
30733069

3074-
var columns = []struct {
3070+
columns := []struct {
30753071
name string
30763072
fieldType string // type used when creating table schema
30773073
databaseTypeName string // actual type used by MySQL
@@ -3284,7 +3280,7 @@ func TestRawBytesAreNotModified(t *testing.T) {
32843280
const blobSize = defaultBufSize * 3 / 4 // Second row overwrites first row.
32853281
const insertRows = 4
32863282

3287-
var sqlBlobs = [2]string{
3283+
sqlBlobs := [2]string{
32883284
strings.Repeat(blob, blobSize/len(blob)),
32893285
strings.Repeat(strings.ToUpper(blob), blobSize/len(blob)),
32903286
}

packets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ func (rows *textRows) readRow(dest []driver.Value) error {
907907
}
908908

909909
func (mc *mysqlConn) skipPackets(n int) error {
910-
for i := 0; i < n; i++ {
910+
for range n {
911911
if _, err := mc.readPacket(); err != nil {
912912
return err
913913
}

0 commit comments

Comments
 (0)