Skip to content

Commit 5dc0ddb

Browse files
refactor: remove calls to deprecated rand.Seed function (#5334)
The function has been deprecated since Go 1.20: https://pkg.go.dev/math/rand#Seed. Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
1 parent 697cd3b commit 5dc0ddb

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

main.go

-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ package main
66

77
import (
88
"fmt"
9-
"math/rand"
109
"os"
11-
"time"
1210

1311
"github.com/elastic/elastic-agent/internal/pkg/agent/cmd"
1412
"github.com/elastic/elastic-agent/pkg/core/process"
@@ -36,7 +34,6 @@ func main() {
3634
}
3735
defer pj.Close()
3836

39-
rand.Seed(time.Now().UnixNano())
4037
command := cmd.NewCommand()
4138
err = command.Execute()
4239
if err != nil {

testing/integration/install_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ func TestRepeatedInstallUninstall(t *testing.T) {
334334
}
335335

336336
func randStr(length int) string {
337-
rand.Seed(time.Now().UnixNano())
338337
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
339338

340339
runes := make([]rune, length)

0 commit comments

Comments
 (0)