From 0643d8d42261e1200aec56fc4aee49edf57f3f5e Mon Sep 17 00:00:00 2001 From: Tiago Natel Date: Fri, 2 Feb 2024 02:31:40 +0000 Subject: [PATCH] chore(gha): fix macos action/setup-go@v4 cache miss. Set the same Go version as specified in the `go.mod` because of many similar issues related to the setup-go cache unable to work when go.mod specifies a different version. - https://github.com/actions/setup-go/issues/424 Additionally, the rand.Seed() was updated to use rand.New(rand.NewSource(seed)) because the former was removed from Go1.20. Signed-off-by: Tiago Natel --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci-experimental.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- cmd/terramate/cli/cloud_credential_google.go | 4 ++-- go.mod | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 022c623ce3..13f831a5b1 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -20,7 +20,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: '1.20' diff --git a/.github/workflows/ci-experimental.yml b/.github/workflows/ci-experimental.yml index a18d4b3176..433e695a32 100644 --- a/.github/workflows/ci-experimental.yml +++ b/.github/workflows/ci-experimental.yml @@ -28,7 +28,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 072e306984..c2002433a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: '1.20' @@ -49,7 +49,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} @@ -79,7 +79,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: '1.20' @@ -100,7 +100,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: '1.20' diff --git a/cmd/terramate/cli/cloud_credential_google.go b/cmd/terramate/cli/cloud_credential_google.go index 2a79dc3348..410c813a55 100644 --- a/cmd/terramate/cli/cloud_credential_google.go +++ b/cmd/terramate/cli/cloud_credential_google.go @@ -148,13 +148,13 @@ func startServer( } }() - rand.Seed(time.Now().UnixNano()) + rng := rand.New(rand.NewSource(time.Now().UnixNano())) var ln net.Listener const maxretry = 5 var retry int for retry = 0; retry < maxretry; retry++ { - addr := "127.0.0.1:" + strconv.Itoa(minPort+rand.Intn(maxPort-minPort)) + addr := "127.0.0.1:" + strconv.Itoa(minPort+rng.Intn(maxPort-minPort)) s.Addr = addr ln, err = net.Listen("tcp", addr) diff --git a/go.mod b/go.mod index dc95cfa99f..1b334d5276 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/terramate-io/terramate -go 1.18 +go 1.20 require ( github.com/alecthomas/kong v0.7.1