Why is GitHub Actions installing Go 1.2 when I specify Go 1.20?

Published on , 223 words, 1 minutes to read

An image of A photo of a bush with tiny white flowers.
A photo of a bush with tiny white flowers. - Photo by Xe Iaso

Because YAML parsing is horrible. YAML supports floating point numbers and the following floating point numbers are identical:

go-versions:
  - 1.2
  - 1.20

To get this working correctly, you need to quote the version number:

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

This will get you Go version 1.20.x, not Go version 1.2.x.

Cadey is coffee
Cadey

I hate YAML.

Worse, this problem will only show up about once every 5 years, so I'm going to add a few blatant SEO farming sentences here:

Quote your version numbers.


Facts and circumstances may have changed since publication. Please contact me before jumping to conclusions if something seems wrong or unclear.

Tags: go, yaml