Closed Le0Developer closed 7 months ago
Hello @Le0Developer Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.
The action should be using the darwin-arm64 ? @Le0Developer have you tried specifying a version?
According to the official docs the arm64 m1 based images do not come with golang preinstalled.
Source: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
Try the following and it should work:
jobs:
build:
name: Build on macOS 14 (M1)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.x'
check-latest: true
- run: go run hello.go
@HarithaVattikuti This action should default to installing the latest Golang on darwin platforms.
@HarithaVattikuti This action should default to installing the latest Golang on darwin platforms.
:thinking: how should this action behaviour in general when Golang is not installed in the system and not version is given. At the moment: the line https://github.com/actions/setup-go/blob/6c1fd22b67f7a7c42ad9a45c0f4197434035e429/src/main.ts#L65 will have goPath == ''
and run:
cp.execSync(` version`)
Resulting in the rather unclear error /bin/sh: version: command not found
(i.e. the error from the issue)
In this case I suppose the action could:
setup-*
actions do this)setup-java
does something similar (but from what I can see it doesn't fallback to trying to use any system install) https://github.com/actions/setup-java/blob/7a445ee88d4e23b52c33fdc7601e40278616c7f8/src/setup-java.ts#L40setup-python
does: https://github.com/actions/setup-python/blob/871daa956ca9ea99f3c3e30acb424b7960676734/src/setup-python.ts#L148 when things will just fail later with some error like go: No such file or directory
when go
is invokedThe action should be using the darwin-arm64 ? @Le0Developer have you tried specifying a version?
According to the official docs the arm64 m1 based images do not come with golang preinstalled.
Source: https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
I'd expect setup-go to setup go, regardless of if it's already installed or not.
Try the following and it should work:
jobs: build: name: Build on macOS 14 (M1) runs-on: macos-14 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.22.x' check-latest: true - run: go run hello.go
That does work! I was expecting it to default to the latest version, but that works!
Hello @Le0Developer, Apologies for the delay in the response and we have investigated the issue and we are able to reproduce the error with go-version input was not specified in the workflow file. The go-version input should specify the version of Go that we want to set up. If it's not provided, the action tries to use a pre-installed version, which seems to be failing.
Here is an example of how to specify the go-version input:
Thank you for the confirmation and we have checked your workflow and the action is successful after adding the go-version. Hello @gaby, actions/setup-go action can indeed be set up to install the latest version of Go. However, it doesn't default to installing the latest version unless you specify it.
To set up the latest stable version of Go, you can use the @latest version specifier in your workflow file:
Proceeding to close this as the issue resolved with go-version. Please feel free to reach us in case of any further clarifications to reopen this issue.
...
To set up the latest stable version of Go, you can use the @latest version specifier in your workflow file:
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.12' check-latest: true
Proceeding to close this as the issue resolved with go-version. Please feel free to reach us in case of any further clarifications to reopen this issue.
Sorry, could you explain more how to use @latest
qualifier as go-version
. I would like to avoid updating go-version
every time there is a major Go release (1.22.x
, 1.23.x
, and so on).
Sorry, could you explain more how to use @latest qualifier as go-version. I would like to avoid updating go-version every time there is a major Go release (1.22.x, 1.23.x, and so on).
You could use the "stable"
and "oldstable"
aliases https://github.com/actions/setup-go?tab=readme-ov-file#using-stableoldstable-aliases
Description:
actions/setup-go
is erroring when used onmacos-14
(M1 runners)Action version:
v5
Platform:
Runner type:
Tools version:
Repro steps:
https://github.com/Le0Developer/go-setup-macos-14
Expected behavior: Should build & print hello world.
Actual behavior: