From f48a0b54d1e01218914fd46984c7fd030181ff84 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Thu, 29 Aug 2024 23:56:11 +0200 Subject: [PATCH 1/3] chore: remove deprecated `rand.Seed()` in testing.docker --- testing/docker.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/testing/docker.go b/testing/docker.go index 2a7c57f98..619257e08 100644 --- a/testing/docker.go +++ b/testing/docker.go @@ -19,7 +19,6 @@ import ( "strconv" "strings" "testing" - "time" ) func NewDockerContainer(t testing.TB, image string, env []string, cmd []string) (*DockerContainer, error) { @@ -286,10 +285,6 @@ type dockerImagePullOutput struct { Progress string `json:"progress"` } -func init() { - rand.Seed(time.Now().UnixNano()) -} - func pseudoRandStr(n int) string { var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz0123456789") b := make([]rune, n) From 90f8a5a37bd40219bc237a993def584c8b81fd07 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Fri, 6 Sep 2024 15:17:40 +0200 Subject: [PATCH 2/3] Use math/rand/v2 --- testing/docker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/docker.go b/testing/docker.go index 619257e08..d418f3568 100644 --- a/testing/docker.go +++ b/testing/docker.go @@ -15,7 +15,7 @@ import ( dockerclient "github.com/docker/docker/client" "github.com/hashicorp/go-multierror" "io" - "math/rand" + "math/rand/v2" "strconv" "strings" "testing" @@ -289,7 +289,7 @@ func pseudoRandStr(n int) string { var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz0123456789") b := make([]rune, n) for i := range b { - b[i] = letterRunes[rand.Intn(len(letterRunes))] + b[i] = letterRunes[rand.IntN(len(letterRunes))] } return string(b) } From f0100ac968b6b838ab4804e85673fcaf9e3e0ac1 Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Fri, 6 Sep 2024 15:21:43 +0200 Subject: [PATCH 3/3] Remove Go 1.21 Go 1.21 doesn't support `math/rand/v2`. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c339251cf..8d08201f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.21.x", "1.22.x"] + go: ["1.22.x"] steps: - uses: actions/checkout@v4