Skip to content

Commit

Permalink
Merge pull request #1343 from pbr0ck3r/pbr0cker/fix/refactor-rand-seed
Browse files Browse the repository at this point in the history
fix: replace rand.seed method to support golang 1.20
  • Loading branch information
stephenafamo authored Jan 21, 2024
2 parents 0c0c4fc + e35e297 commit 0ccf00c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/sqlboiler-sqlite3/driver/sqlite3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
)

func TestDriver(t *testing.T) {
rand.Seed(time.Now().Unix())
rand.New(rand.NewSource(time.Now().Unix()))
b, err := os.ReadFile("testdatabase.sql")
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion templates/test/singleton/boil_main_test.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestMain(m *testing.M) {
os.Exit(-1)
}

rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))

flag.Parse()

Expand Down
14 changes: 7 additions & 7 deletions types/array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func TestBoolArrayValue(t *testing.T) {
}

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

func BenchmarkBytesArrayValue(b *testing.B) {
rand.Seed(1)
rand.New(rand.NewSource(1))
x := make([][]byte, 10)
for i := 0; i < len(x); i++ {
x[i] = make([]byte, len(x))
Expand Down Expand Up @@ -634,7 +634,7 @@ func TestFloat64ArrayValue(t *testing.T) {
}

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

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

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

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

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

0 comments on commit 0ccf00c

Please sign in to comment.