From 4eac547a08b7b103c83828be1cdbea37779d6896 Mon Sep 17 00:00:00 2001 From: "Luis Gustavo S. Barreto" Date: Mon, 12 May 2025 10:23:30 -0300 Subject: [PATCH] ci: use local Go toolchain and downgrade Go version The GitHub Actions workflow defines: ```yaml strategy: matrix: go: ['1.23', '1.24'] ``` However, the `1.23` job still ends up running Go `1.24`. By default, `actions/setup-go` leaves `GOTOOLCHAIN=auto`, causing go itself to fetch the version specified in `go.mod` instead instead of sticking to exactly `1.23`. This led to a false positive in CI: it appeared as if the matrix was testing Go `1.23`, when in reality all jobs were using Go `1.24`. To fix this, we need to force the use of the local Go toolchain in the CI test workflow to ensure the use of the locally installed Go version and avoid automatic downloads by `setup-go`. Also downgrades the Go version in `go.mod` from `1.24` to `1.23` to ensure compatibility with environments that do not yet support Go `1.24`. Fixes #126 --- .github/workflows/golangci-lint.yml | 9 +++++++-- .github/workflows/test.yml | 2 ++ go.mod | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index b4a755a..2b05629 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -20,14 +20,19 @@ jobs: golangci: name: lint runs-on: ubuntu-latest + env: + GOTOOLCHAIN: local strategy: matrix: - go: ['1.24'] + go: ['1.23', '1.24'] steps: + - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - - uses: actions/checkout@v4 + + - name: Tidy + run: go mod tidy - name: Format run: go fmt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30f0ae1..86f54a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ on: jobs: test: runs-on: ubuntu-latest + env: + GOTOOLCHAIN: local strategy: fail-fast: false matrix: diff --git a/go.mod b/go.mod index a844df8..c5d2a66 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/pires/go-proxyproto -go 1.24 +go 1.23 require golang.org/x/net v0.39.0