actions / setup-go

Set up your GitHub Actions workflow with a specific version of Go
MIT License
1.41k stars 531 forks source link

setup-go@v5 installs newer go than requested #519

Open anderbubble opened 1 day ago

anderbubble commented 1 day ago

Description:

Since upgrading from setup-go@v3 to setup-go@v5, our matrix strategy workflows are failing due to a go version mismatch. Versions of the tests that are attempting to use previous versions of go are running with later-version libraries, causing failures.

Example: https://github.com/warewulf/warewulf/actions/runs/12079627670/job/33685781604?pr=1556

Logs indicate that after setup-go installs the requested version of go, it then installs 1.23.3. This causes tests to run against golang.org/toolchain@v0.0.1-go1.23.3.linux-amd64, which is incompatible with requested golang versions 1.21 and 1.22.

Action version: v5

Platform:

Runner type:

Tools version:

1.21 and 1.22 (erroneously installs 1.23).

Repro steps:

inputs:
  go-version:
    description: "go version"
    required: true
runs:
  using: "composite"
  steps:
[...]
    - name: Setup go ${{ inputs.go-version }}
      uses: actions/setup-go@v5
      with:
        go-version: ${{ inputs.go-version }}
        cache: false
        check-latest: false
[...]

See also: https://github.com/warewulf/warewulf/blob/main/.github/actions/prepare/action.yml

Expected behavior:

Should install the requested golang version, and only that version.

Actual behavior:

Installs the requested golang version and then a newer golang version.

Run actions/setup-go@v5
Setup go version spec 1.22
Found in cache @ /opt/hostedtoolcache/go/1.22.9/x64
Added go to the path
Successfully set up Go version 1.22
go: downloading go1.23.3 (linux/amd64)
go version go1.23.3 linux/amd64
anderbubble commented 1 day ago

Disabling the cache did not appear to resolve this behavior: https://github.com/warewulf/warewulf/actions/runs/12080202374/job/33687202383?pr=1570