Skip to content

Commit

Permalink
root: silence staticcheck note about deprecated rand.Seed
Browse files Browse the repository at this point in the history
The latest lint CI run failed with

  SA1019: rand.Seed has been deprecated since Go 1.20 and an
  alternative has been available since Go 1.0: As of Go 1.20 there is
  no reason to call Seed with a random value. [...]

So once our minimum Go version is 1.2.0, we can remove this.
  • Loading branch information
kyleam committed Aug 21, 2024
1 parent 68fc321 commit 9b45e54
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func NewRootCmd() *cobra.Command {
}

// Set random for application
//lint:ignore SA1019 Remove Seed call once minimum Go is 1.20
rand.Seed(time.Now().UnixNano())

Check failure on line 76 in cmd/root.go

View workflow job for this annotation

GitHub Actions / lint

SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: As of Go 1.20 there is no reason to call Seed with a random value. Programs that call Seed with a known value to get a specific sequence of results should use New(NewSource(seed)) to obtain a local random generator. (staticcheck)

cobra.OnInitialize(initConfig)
Expand Down

0 comments on commit 9b45e54

Please sign in to comment.