actions / setup-go

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

Overriding go-version with latest regardless of settings #516

Open ross-spencer opened 1 day ago

ross-spencer commented 1 day ago

Description:

I have the following configured:

    - name: Set up Go
      uses: actions/setup-go@v5
      with:
        go-version: '1.22'
    - run: go version

But in GitHub the workflow is always downloading 1.23.3:

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)
/opt/hostedtoolcache/go/1.22.[9](https://github.com/ocfl-archive/error/actions/runs/11952824712/job/33319397499#step:4:10)/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.22.9/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Cache is not found
go version go1.23.3 linux/amd64

Action version:

V5.

Platform:

Runner type:

Tools version:

Expected 1.22 getting 1.23.3

Repro steps:

Currently running in this PR here: https://github.com/ocfl-archive/error/pull/1/files#diff-717013d02a8afac81852f25ba8ecd3cc0ca53a7f1fe25bedebfd66d6f518d21c

Expected behavior: A description of what you expected to happen.

Configuration of Go version should work.

Actual behavior: A description of what is actually happening.

It looks like Go 1.22 is successfully installed and then it is overridden by 1.23. It shows up quite profoundly in this workflow because staticcheck is not compiled for 1.23.

ross-spencer commented 1 day ago

I've tried a few things including ignoring cache, the runner looks like this now:

Run actions/setup-go@v5
  with:
    go-version: 1.[2](https://github.com/ocfl-archive/error/actions/runs/11953409989/job/33321226432#step:4:2)2
    cache: false
    check-latest: false
    token: ***
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.2[3](https://github.com/ocfl-archive/error/actions/runs/11953409989/job/33321226432#step:4:3).3 (linux/amd64)
go version go1.23.3 linux/amd6[4](https://github.com/ocfl-archive/error/actions/runs/11953409989/job/33321226432#step:4:4)

go env

I wonder if it is being overridden by go.mod? (can that be explicitly ignored?)

EDIT: i'm sure i'm doing something stupid here, just can't figure out what.

aparnajyothi-y commented 23 hours ago

Hello @ross-spencer, Thank you for creating this issue and we will look into it :)