Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace rand.seed method to support golang 1.20 #1343

Merged

Conversation

pbr0ck3r
Copy link
Contributor

@pbr0ck3r pbr0ck3r commented Jan 21, 2024

What this PR does / why we need it

  • Replace rand.seed(1) method to be rand.New(rand.NewSource(1)) in order to allow sqlboiler to generate code compatible with Golang 1.20. Ensured methods exist in Golang 1.16, https://pkg.go.dev/math/rand@go1.16

staticcheck error:

 rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: Programs that call Seed and then expect a specific sequence of results from the global random source (using functions such as Int) can be broken when a dependency changes how much it consumes from the global random source. To avoid such breakages, programs that need a specific result sequence should use NewRand(NewSource(seed)) to obtain a random generator that other packages cannot access.  (SA1019)

@pbr0ck3r pbr0ck3r changed the title fix: update rand.seed method to support with golang 1.20 fix: update rand.seed method to support golang 1.20 Jan 21, 2024
@pbr0ck3r pbr0ck3r changed the title fix: update rand.seed method to support golang 1.20 fix: replace rand.seed method to support golang 1.20 Jan 21, 2024
@stephenafamo stephenafamo merged commit 0ccf00c into volatiletech:master Jan 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants