Skip to content

Commit e35e297

Browse files
author
Devbase CI
committed
fix: update rand.seed method to support with golang 1.20
1 parent 0c0c4fc commit e35e297

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

drivers/sqlboiler-sqlite3/driver/sqlite3_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
)
2323

2424
func TestDriver(t *testing.T) {
25-
rand.Seed(time.Now().Unix())
25+
rand.New(rand.NewSource(time.Now().Unix()))
2626
b, err := os.ReadFile("testdatabase.sql")
2727
if err != nil {
2828
t.Fatal(err)

templates/test/singleton/boil_main_test.go.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestMain(m *testing.M) {
1919
os.Exit(-1)
2020
}
2121

22-
rand.Seed(time.Now().UnixNano())
22+
rand.New(rand.NewSource(time.Now().UnixNano()))
2323

2424
flag.Parse()
2525

types/array_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func TestBoolArrayValue(t *testing.T) {
326326
}
327327

328328
func BenchmarkBoolArrayValue(b *testing.B) {
329-
rand.Seed(1)
329+
rand.New(rand.NewSource(1))
330330
x := make([]bool, 10)
331331
for i := 0; i < len(x); i++ {
332332
x[i] = rand.Intn(2) == 0
@@ -477,7 +477,7 @@ func TestBytesArrayValue(t *testing.T) {
477477
}
478478

479479
func BenchmarkBytesArrayValue(b *testing.B) {
480-
rand.Seed(1)
480+
rand.New(rand.NewSource(1))
481481
x := make([][]byte, 10)
482482
for i := 0; i < len(x); i++ {
483483
x[i] = make([]byte, len(x))
@@ -634,7 +634,7 @@ func TestFloat64ArrayValue(t *testing.T) {
634634
}
635635

636636
func BenchmarkFloat64ArrayValue(b *testing.B) {
637-
rand.Seed(1)
637+
rand.New(rand.NewSource(1))
638638
x := make([]float64, 10)
639639
for i := 0; i < len(x); i++ {
640640
x[i] = rand.NormFloat64()
@@ -787,7 +787,7 @@ func TestInt64ArrayValue(t *testing.T) {
787787
}
788788

789789
func BenchmarkInt64ArrayValue(b *testing.B) {
790-
rand.Seed(1)
790+
rand.New(rand.NewSource(1))
791791
x := make([]int64, 10)
792792
for i := 0; i < len(x); i++ {
793793
x[i] = rand.Int63()
@@ -1229,7 +1229,7 @@ func TestGenericArrayValueErrors(t *testing.T) {
12291229
}
12301230

12311231
func BenchmarkGenericArrayValueBools(b *testing.B) {
1232-
rand.Seed(1)
1232+
rand.New(rand.NewSource(1))
12331233
x := make([]bool, 10)
12341234
for i := 0; i < len(x); i++ {
12351235
x[i] = rand.Intn(2) == 0
@@ -1242,7 +1242,7 @@ func BenchmarkGenericArrayValueBools(b *testing.B) {
12421242
}
12431243

12441244
func BenchmarkGenericArrayValueFloat64s(b *testing.B) {
1245-
rand.Seed(1)
1245+
rand.New(rand.NewSource(1))
12461246
x := make([]float64, 10)
12471247
for i := 0; i < len(x); i++ {
12481248
x[i] = rand.NormFloat64()
@@ -1255,7 +1255,7 @@ func BenchmarkGenericArrayValueFloat64s(b *testing.B) {
12551255
}
12561256

12571257
func BenchmarkGenericArrayValueInt64s(b *testing.B) {
1258-
rand.Seed(1)
1258+
rand.New(rand.NewSource(1))
12591259
x := make([]int64, 10)
12601260
for i := 0; i < len(x); i++ {
12611261
x[i] = rand.Int63()

0 commit comments

Comments
 (0)