Drop calls to rand.Seed

The rng has been automatically seeded since go1.20, and explicitly seeding it has been a no-op since go1.24. Ref: https://go.dev/doc/godebug#go-120 and https://go.dev/doc/godebug#go-124

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
Brad Davidson 2025-10-01 23:21:15 +00:00 committed by Brad Davidson
parent 3190f30de8
commit 89adabb672
3 changed files with 0 additions and 9 deletions

View file

@ -3,7 +3,6 @@ package agent
import (
"context"
"fmt"
"math/rand"
"net"
"os"
"path/filepath"
@ -35,7 +34,6 @@ import (
)
func Agent(ctx context.Context, nodeConfig *daemonconfig.Node, proxy proxy.Proxy) error {
rand.Seed(time.Now().UTC().UnixNano())
logsapi.ReapplyHandling = logsapi.ReapplyHandlingIgnoreUnchanged
logs.InitLogs()
defer logs.FlushLogs()

View file

@ -3,7 +3,6 @@ package control
import (
"context"
"errors"
"math/rand"
"os"
"path/filepath"
"strconv"
@ -42,8 +41,6 @@ import (
// Prepare loads bootstrap data from the datastore and sets up the initial
// tunnel server request handler and stub authenticator.
func Prepare(ctx context.Context, wg *sync.WaitGroup, cfg *config.Control) error {
rand.Seed(time.Now().UTC().UnixNano())
logsapi.ReapplyHandling = logsapi.ReapplyHandlingIgnoreUnchanged
if err := prepare(ctx, wg, cfg); err != nil {
return pkgerrors.WithMessage(err, "preparing server")

View file

@ -2,11 +2,9 @@ package kubectl
import (
"fmt"
"math/rand"
"os"
"runtime"
"strings"
"time"
"github.com/k3s-io/k3s/pkg/server"
"github.com/sirupsen/logrus"
@ -44,8 +42,6 @@ func Main() {
}
func main() {
rand.Seed(time.Now().UnixNano())
command := cmd.NewDefaultKubectlCommand()
if err := cli.RunNoErrOutput(command); err != nil {
util.CheckErr(err)