Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Kamil Dziedzic <kamil at klecza.pl>
Kei Kamikawa <x00.x7f.x86 at gmail.com>
Kevin Malachowski <kevin at chowski.com>
Kieron Woodhouse <kieron.woodhouse at infosum.com>
Koichi Shiraishi <zchee.io at gmail.com>
Lance Tian <lance6716 at gmail.com>
Lennart Rudolph <lrudolph at hmc.edu>
Leonardo YongUk Kim <dalinaum at gmail.com>
Expand Down
10 changes: 5 additions & 5 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func benchmarkQuery(b *testing.B, compr bool) {
defer wg.Wait()
b.StartTimer()

for i := 0; i < concurrencyLevel; i++ {
for range concurrencyLevel {
go func() {
for {
if atomic.AddInt64(&remain, -1) < 0 {
Expand Down Expand Up @@ -129,7 +129,7 @@ func BenchmarkExec(b *testing.B) {
b.ReportAllocs()
b.ResetTimer()

for i := 0; i < concurrencyLevel; i++ {
for range concurrencyLevel {
go func() {
for {
if atomic.AddInt64(&remain, -1) < 0 {
Expand Down Expand Up @@ -345,7 +345,7 @@ func BenchmarkQueryRawBytes(b *testing.B) {
for i := range blob {
blob[i] = 42
}
for i := 0; i < 100; i++ {
for i := range 100 {
_, err := db.Exec("INSERT INTO bench_rawbytes VALUES (?, ?)", i, blob)
if err != nil {
b.Fatal(err)
Expand Down Expand Up @@ -404,7 +404,7 @@ func benchmark10kRows(b *testing.B, compress bool) {
args[i] = sval
}
for i := 0; i < 10000; i += 100 {
for j := 0; j < 100; j++ {
for j := range 100 {
args[j*2] = i + j
}
_, err := stmt.Exec(args...)
Expand Down Expand Up @@ -462,7 +462,7 @@ func BenchmarkReceiveMetadata(b *testing.B) {

// Create a table with 1000 integer fields
createTableQuery := "CREATE TABLE large_integer_table ("
for i := 0; i < 1000; i++ {
for i := range 1000 {
createTableQuery += fmt.Sprintf("col_%d INT", i)
if i < 999 {
createTableQuery += ", "
Expand Down
8 changes: 2 additions & 6 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func runTests(t *testing.T, dsn string, tests ...func(dbt *DBTest)) {
cleanupSql := "DROP TABLE IF EXISTS test"

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

t.Parallel()
for _, test := range tests {
test := test

t.Run("default", func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -491,7 +488,6 @@ func TestMultiQuery(t *testing.T) {
dbt.Error("no data")
}
rows.Close()

})
}

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

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

var sqlBlobs = [2]string{
sqlBlobs := [2]string{
strings.Repeat(blob, blobSize/len(blob)),
strings.Repeat(strings.ToUpper(blob), blobSize/len(blob)),
}
Expand Down
2 changes: 1 addition & 1 deletion packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ func (rows *textRows) readRow(dest []driver.Value) error {
}

func (mc *mysqlConn) skipPackets(n int) error {
for i := 0; i < n; i++ {
for range n {
if _, err := mc.readPacket(); err != nil {
return err
}
Expand Down