Skip to main content
ertius.org

yaml strikes again

Earlier, I added a step to download and install Go inside the container running the GitHub action:

- name: Setup Go
  uses: actions/setup-go@v4
  with:
    go-version: 1.20

picking whatever version of Go I had installed locally, and then tested it using act, and it worked fine. So, I pushed to GitHub and got:

Successfully set up Go version 1.2
...
Run hugo -s . -d $GITHUB_WORKSPACE/dist
go: unknown subcommand "mod"
Run 'go help' for usage.
Total in 10 ms
Error: failed to load modules: failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: unknown subcommand "mod"

1.2? "unknown subcommand mod"? Ah, of course, YAML parses things to floats, and I am guessing the JS printer uses a different output format - as "1.2" rather than "1.20".

Changing it to:

- name: Setup Go
  uses: actions/setup-go@v4
  with:
    go-version: "1.20"

fixes it by making YAML parse it as a string.