mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
Fix rand.Seed() deprecation in golang 1.20
Ref: https://pkg.go.dev/math/rand@go1.20#Seed Note: For `runtime_test.go`, this test-case was never actually doing what appears as it's intent . Fixing it to work as intended would be require incredibly libpod-invasive changes. Do the least-worse thing and simply confirm that consecutive generated names are different. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -118,13 +117,6 @@ type Runtime struct {
|
||||
secretsManager *secrets.SecretsManager
|
||||
}
|
||||
|
||||
func init() {
|
||||
// generateName calls namesgenerator.GetRandomName which the
|
||||
// global RNG from math/rand. Seed it here to make sure we
|
||||
// don't get the same name every time.
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
// SetXdgDirs ensures the XDG_RUNTIME_DIR env and XDG_CONFIG_HOME variables are set.
|
||||
// containers/image uses XDG_RUNTIME_DIR to locate the auth file, XDG_CONFIG_HOME is
|
||||
// use for the containers.conf configuration file.
|
||||
|
Reference in New Issue
Block a user