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 <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman 2024-05-21 11:08:59 +01:00
parent 75a201389d
commit 865fa9da15

View File

@ -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\""})