From 865fa9da15d6da76b453c36e7b4b9388373bcc9f Mon Sep 17 00:00:00 2001 From: stevenhorsman Date: Tue, 21 May 2024 11:08:59 +0100 Subject: [PATCH] runtime: Resolve go static-checks failure Remove `rand.Seed` call to resolve the following failure: ``` rand.Seed is deprecated: As of Go 1.20 there is no reason to call Seed with a random value. ``` The go rand.Seed docs: https://pkg.go.dev/math/rand@go1.20#Seed back this up and states: > If Seed is not called, the generator is seeded randomly at program startup. so I believe we can just delete the call. Signed-off-by: stevenhorsman --- src/runtime/pkg/utils/utils.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/runtime/pkg/utils/utils.go b/src/runtime/pkg/utils/utils.go index 1a6c484ec0..a2a331840c 100644 --- a/src/runtime/pkg/utils/utils.go +++ b/src/runtime/pkg/utils/utils.go @@ -13,7 +13,6 @@ import ( "os/exec" "path/filepath" "strings" - "time" "github.com/sirupsen/logrus" ) @@ -125,7 +124,6 @@ func CreateVmmUser() (string, error) { // Add retries to mitigate temporary errors and race conditions. For example, the user already exists // or another instance of the runtime is also creating a user. maxAttempt := 5 - rand.Seed(time.Now().UnixNano()) for i := 0; i < maxAttempt; i++ { userName = fmt.Sprintf("kata-%v", rand.Intn(100000)) _, err = RunCommand([]string{useraddPath, "-M", "-s", nologinPath, userName, "-c", "\"Kata Containers temporary hypervisor user\""})