From 9fae21f6b18633b2a9e6fd594b649eb3f0d13747 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Thu, 11 Apr 2024 21:38:49 +0100 Subject: [PATCH 1/2] Fix `go` directive in `go.mod` The docs[1] say: > The version must be a valid Go version, such as 1.9, 1.14, or 1.21rc1. A 'Go version' is a go release[2], but there's no release of Go `1.22` (compare with Go `1.20` that _does_ have a release) the first release of Go `1.22` was Go `1.22.0` so use that here. This will cause issue in any environment where parsing this module triggers a toolchain download (i.e. something running Go `1.21`, since before then the directive was only advisory, and with the `GOTOOLCHAIN` env var not set to `none`), for example: $ docker run --rm --interactive --volume "$PWD:/work" --workdir /work golang:1.21.0 go mod tidy go: downloading go1.22 (linux/amd64) go: download go1.22 for linux/amd64: toolchain not available This change should have no impact on any setup that works with the current directive. There's more detail and discussions around this at[4] [1] https://go.dev/ref/mod#go-mod-file-go [2] https://go.dev/doc/toolchain#version [3] https://go.dev/doc/devel/release [4] https://github.com/golang/go/issues/62278 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index e779ae75fc4..10eacaec6c4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/cli/cli/v2 -go 1.22 +go 1.22.0 require ( github.com/AlecAivazis/survey/v2 v2.3.7 From 1cb8edce390aaadb3754b6968ef555feca2581b5 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Mon, 15 Apr 2024 15:44:56 +0100 Subject: [PATCH 2/2] squash! Fix `go` directive in `go.mod` Keep `go` version relaxed, pair with a `toolchain` directive so that: * We still get the functional fix (e.g. building with `GOTOOLCHAIN=local`) * We still get the `setup-go` action just pulling in the latest version of Go 1.22 when available without having to add a version constraint there --- go.mod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 10eacaec6c4..1f76ac7e2af 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/cli/cli/v2 -go 1.22.0 +go 1.22 + +toolchain go1.22.2 require ( github.com/AlecAivazis/survey/v2 v2.3.7