Use go.mod as source of Go version number for workflows by per1234 · Pull Request #801 · arduino/arduino-lint (original) (raw)

Go is used in the development and maintenance of the project. A standardized version of Go is used for all operations.

This version is defined in the go directive of the go.mod metadata file.

Go is installed in the GitHub Actions runner environments using the actions/setup-go action, which also must be configured to install the correct version of Go. Previously the version number for use by the actions/setup-go action was defined in each workflow. This meant that we had multiple copies of the Go version information, all of which had to be kept in sync.

Fortunately, support for using go.mod as the source of version information for the actions/setup-go action was recently added:

https://github.com/actions/setup-go/tree/main#getting-go-version-from-the-gomod-file

This means it is now possible for all workflows to get the Go version from a single source.