From aeb3423e9d7c9927967e73e0e7cd57fe5a1b3b5f Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 13 Sep 2024 00:10:46 -0400 Subject: [PATCH] mantle/kola: remove rand.Seed() This is to appease golangci-lint: ``` Error: 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) ``` According to https://pkg.go.dev/math/rand#Seed "If Seed is not called, the generator is seeded randomly at program startup." so I think it's safe to just drop it. --- mantle/cmd/kola/kola.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mantle/cmd/kola/kola.go b/mantle/cmd/kola/kola.go index 44341a1295..fc8a4066e9 100644 --- a/mantle/cmd/kola/kola.go +++ b/mantle/cmd/kola/kola.go @@ -17,7 +17,6 @@ package main import ( "encoding/json" "fmt" - "math/rand" "net/http" "os" "path/filepath" @@ -25,7 +24,6 @@ import ( "sort" "strings" "text/tabwriter" - "time" "github.com/coreos/pkg/capnslog" "github.com/pkg/errors" @@ -160,8 +158,6 @@ func init() { } func main() { - // initialize global state - rand.Seed(time.Now().UnixNano()) cli.Execute(root) }