Lock Go version
Is your feature request related to a problem? Please describe.
I found in my previous PR that the GitHub setup-go action is configured to 1.17.z with caret comparator https://github.com/npm/node-semver#caret-ranges-123-025-004 that is why my first try failed.
As of now go.mod is set to Go 1.16 but the setup-go action will always use the latest 1.minor version.
On the other hand Dockerfile builder image is not locked.
Describe the solution you'd like
Match Go major.minor version in go.mod, in Dockerfile and use any patch version in setup-go configuration from the same major.minor.
Describe alternatives you've considered
Lock specific version in setup-go configuration, in Dockerfile and set major.minor version in go.mod
Additional context
I would use Go 1.19 and call rm -f go.sum && go mod tidy -go=1.19 as part of this intention.
Hey @alex1989hu, thanks for suggestions. Some feedback from my side:
go.mod references a minimum version of Go required by the module as per docs, so we increase it periodically. v1.16 is a valid version so far.
setup-go the way it's set in Github Actions allows me to stay up to date with a new released Go version whenever it's generally available, and to fail early if there is any issue.
In your case, I'd say there wasn't much of a problem - it wasn't a compile issue, but a part of the workflow to keep go fmt applied consistently. Apparently, go v1.19 introduced changes for go style. Moreover, those comments will go away anyway as there's another PR to refactor drivers initialization.
Since there's no automated release management for container image builds anymore (as Docker Inc. removed such an opportunity sometime ago), we know in advance what version of Go is the latest and available (via GHA) to be used during container image builds.
As sql_exporter hasn't reached v1.0, I consider this ok. We can come back to this topic later, though. :)