@@ -26,6 +26,7 @@ import (
2626 "os"
2727 "reflect"
2828 "runtime"
29+ "slices"
2930 "strconv"
3031 "strings"
3132 "sync"
@@ -1926,7 +1927,7 @@ func TestPreparedManyCols(t *testing.T) {
19261927 rows .Close ()
19271928
19281929 // Create 0byte string which we can't send via STMT_LONG_DATA.
1929- for i := 0 ; i < numParams ; i ++ {
1930+ for i := range numParams {
19301931 params [i ] = ""
19311932 }
19321933 rows , err = stmt .Query (params ... )
@@ -1971,7 +1972,7 @@ func TestConcurrent(t *testing.T) {
19711972 })
19721973 }
19731974
1974- for i := 0 ; i < max ; i ++ {
1975+ for i := range max {
19751976 go func (id int ) {
19761977 defer wg .Done ()
19771978
@@ -2355,7 +2356,7 @@ func TestPing(t *testing.T) {
23552356 q .Close ()
23562357
23572358 // Verify that Ping() clears both fields.
2358- for i := 0 ; i < 2 ; i ++ {
2359+ for range 2 {
23592360 if err := c .Ping (ctx ); err != nil {
23602361 dbt .fail ("Pinger" , "Ping" , err )
23612362 }
@@ -2558,7 +2559,7 @@ func TestMultiResultSet(t *testing.T) {
25582559 }
25592560 defer stmt .Close ()
25602561
2561- for j := 0 ; j < 2 ; j ++ {
2562+ for j := range 2 {
25622563 rows , err := stmt .Query ()
25632564 if err != nil {
25642565 dbt .Fatalf ("%v (i=%d) (j=%d)" , err , i , j )
@@ -2665,7 +2666,7 @@ func TestQueryMultipleResults(t *testing.T) {
26652666 c := conn .(* mysqlConn )
26662667
26672668 // Demonstrate that repeated queries reset the affectedRows
2668- for i := 0 ; i < 2 ; i ++ {
2669+ for range 2 {
26692670 _ , err := qr .Query (`
26702671 INSERT INTO test (value) VALUES ('a'), ('b');
26712672 INSERT INTO test (value) VALUES ('c'), ('d'), ('e');
@@ -3293,11 +3294,11 @@ func TestRawBytesAreNotModified(t *testing.T) {
32933294
32943295 runTests (t , dsn , func (dbt * DBTest ) {
32953296 dbt .mustExec ("CREATE TABLE test (id int, value BLOB) CHARACTER SET utf8" )
3296- for i := 0 ; i < insertRows ; i ++ {
3297+ for i := range insertRows {
32973298 dbt .mustExec ("INSERT INTO test VALUES (?, ?)" , i + 1 , sqlBlobs [i & 1 ])
32983299 }
32993300
3300- for i := 0 ; i < contextRaceIterations ; i ++ {
3301+ for i := range contextRaceIterations {
33013302 func () {
33023303 ctx , cancel := context .WithCancel (context .Background ())
33033304 defer cancel ()
@@ -3552,8 +3553,8 @@ func TestConnectionAttributes(t *testing.T) {
35523553 rowsMap [attrName ] = attrValue
35533554 }
35543555
3555- connAttrs := append ( append ([] string {}, defaultAttrs ... ) , customAttrs ... )
3556- expectedAttrValues := append ( append ([] string {}, defaultAttrValues ... ) , customAttrValues ... )
3556+ connAttrs := slices . Concat ( defaultAttrs , customAttrs )
3557+ expectedAttrValues := slices . Concat ( defaultAttrValues , customAttrValues )
35573558 for i := range connAttrs {
35583559 if gotValue := rowsMap [connAttrs [i ]]; gotValue != expectedAttrValues [i ] {
35593560 dbt .Errorf ("expected %q, got %q" , expectedAttrValues [i ], gotValue )
@@ -3637,7 +3638,7 @@ func TestIssue1567(t *testing.T) {
36373638 count = max
36383639 }
36393640
3640- for i := 0 ; i < count ; i ++ {
3641+ for range count {
36413642 timeout := time .Duration (mrand .Int63n (int64 (rtt )))
36423643 ctx , cancel := context .WithTimeout (context .Background (), timeout )
36433644 dbt .db .PingContext (ctx )
0 commit comments