Closed AviDuda closed 4 months ago
Interesting. I am not familiar with go.work
so I'd have to read up or take suggestions.
If you have a go.mod
file inside your work space, then just hitting gobrew
command should bring up the interactive and ask you to change the go version based on go.mod
.
For actions, you can use gobrew noninteractive
Hope that helped
And for the action, you can also do this
- uses: kevincobain2000/action-gobrew@v2
working-directory: myapp
with:
version: mod
I wasn't familiar with it either, it surprised me when I saw the error. The Go extension links to this document.
This is my current go.work file in the root directory:
go 1.20
use ./apps/my-app
Thanks for the tip about the action, I missed that I can do this. Would be nice to explicitly mention in the readme that mod
is a valid gobrew version name (it's in the CLI help and in the action example but it's easily missable, looks like the help command in the readme is outdated).
Edit: Looks like the working-directory
doesn't support uses
, it supports only run
steps.
Edit: Looks like the working-directory doesn't support uses, it supports only run steps.
Oh yea, right
This should fix it https://github.com/kevincobain2000/action-gobrew/pull/3
And
looks like the help command in the readme is outdated
Would be nice to explicitly mention in the readme that mod is a valid gobrew version name
Yea, sorry, README was a bit out of touch. I have updated it now.
This should fix it https://github.com/kevincobain2000/gobrew/pull/185
All pushed and merged.
Go workspaces have a Go version specified in them but gobrew doesn't support it at the moment.
My use case: I have a Nx monorepo with a mix of Go and React apps. These apps are in
apps/<dir>
, but VS Code's Go extension complains when I don't have thego.work
file in the root directory of the monorepo.This is the error when opening any Go file:
Being able to detect the current Go version from the
go.work
file would help a lot so I could easily wire it up to GitHub Actions builds without having to manually edit it in multiple places.