thockin / go-build-template

A Makefile/Dockerfile example for Go projects.
Apache License 2.0
3.24k stars 430 forks source link

Migrate to GOTOOLCHAIN #119

Open BenTheElder opened 1 month ago

BenTheElder commented 1 month ago

We should migrate away from the custom GO_VERSION to the standardized GOTOOLCHAIN (and also stop overriding it in the makefile by default versus telling users to set toolchain in their go.mod, but allow callers to override the module with GOTOOLCHAIN)

I would propose a transition period where GO_VERSION is read if set and a warning is produced while translating it to the GOTOOLCHAIN equivilant.

I've been thinking about how to approach this for kubernetes, one caveat remains that toolchain is per-module if not overridden by the env, versus GO_VERSION right now means the default is a single repo-scoped value (for multi-module repos).

The user overridden GOTOOLCHAIN or GO_VERSION would easily remain repo-scoped, but the default value would not and some diligence is needed to ensure all modules are in sync.

thockin commented 1 month ago

PRs welcome - this repo is OK with breaking changes, since it is a template.