Is it possible to to specify a Go version in a Taskfile?

When building a Taskfile.yml, is it possible to specify the Go version used when building the application? This is all I have in my Taskfile.yml:
version: 3

tasks:
build:
cmds:
- go build .
version: 3

tasks:
build:
cmds:
- go build .
4 Replies
andreynering
andreynering3w ago
Hi @HighDesertStorm, Your Taskfile will call whatever go binary is available in your PATH. You can call go version to know its version. If you want a different version, you'll need to install it yourself.
HighDesertStorm
HighDesertStormOP3w ago
@andreynering - what if Go is not installed? I saw it download Go when it’s not installed. I’m assuming it just using the version in the go.mod file?
andreynering
andreynering3w ago
@HighDesertStorm Task certainly won't download Go for you. It's a generic task runner: it will basically just run the commands you've configured on your Taskfile.
HighDesertStorm
HighDesertStormOP3w ago
@andreynering that’s interesting… I deleted go from my system, ran the Taskfile that I put here and it listed a step and said it was downloading Go
Want results from more Discord servers?
Add your server