andrewkroh / gvm

Go Version Manager (written in Go for cross-platform usability)
Apache License 2.0
195 stars 24 forks source link

GVM cannot install 1.21 #61

Closed andrewvc closed 1 year ago

andrewvc commented 1 year ago

Go version 1.21 has been released, but unlike previous versions the file that needs to be downloaded is 1.21.0. This means both gvm install 1.21 and gvm install 1.21.0 fail for different reasons; the former due to no file being found and the latter due to it being an invalid version.

A workaround is to manually perform the following:

cd ~/.gvm/versions
curl https://storage.googleapis.com/golang/go1.21.0.darwin-arm64.tar.gz
tar -xzf go1.21.0.darwin-arm64.tar.gz
# note this is 1.21 NOT 1.21.0 in this spot
mv go go1.21.darwin.arm64

A good fix might be, in the case of minor releases, to check both x.y and x.y.0 as downloads to be robust against future changes either way from the go team.

andrewkroh commented 1 year ago

A secondary issue is that the tar files for Go 1.21 no longer contain directory entries. This affects the ability to untar the files by gvm:

% tar tvf ~/Downloads/go1.20.7.darwin-arm64.tar.gz | head
drwxr-xr-x  0 0      0           0 Jul 26 17:42 go/
-rw-r--r--  0 gopher wheel    1339 Jul 26 17:40 go/CONTRIBUTING.md
-rw-r--r--  0 gopher wheel    1479 Jul 26 17:40 go/LICENSE
-rw-r--r--  0 gopher wheel    1303 Jul 26 17:40 go/PATENTS
-rw-r--r--  0 gopher wheel    1455 Jul 26 17:40 go/README.md
-rw-r--r--  0 gopher wheel     419 Jul 26 17:40 go/SECURITY.md
-rw-r--r--  0 gopher wheel       8 Jul 26 17:40 go/VERSION
drwxr-xr-x  0 gopher wheel       0 Jul 26 17:41 go/api/
-rw-r--r--  0 gopher wheel    1142 Jul 26 17:40 go/api/README
-rw-r--r--  0 gopher wheel   34102 Jul 26 17:40 go/api/except.txt

% tar tvf ~/Downloads/go1.21.0.darwin-arm64.tar.gz | head
-rw-r--r--  0 0      0        1337 Aug  4 16:14 go/CONTRIBUTING.md
-rw-r--r--  0 0      0        1479 Aug  4 16:14 go/LICENSE
-rw-r--r--  0 0      0        1303 Aug  4 16:14 go/PATENTS
-rw-r--r--  0 0      0        1455 Aug  4 16:14 go/README.md
-rw-r--r--  0 0      0         419 Aug  4 16:14 go/SECURITY.md
-rw-r--r--  0 0      0          35 Aug  4 16:14 go/VERSION
-rw-r--r--  0 0      0        1142 Aug  4 16:14 go/api/README
-rw-r--r--  0 0      0       35424 Aug  4 16:14 go/api/except.txt
-rw-r--r--  0 0      0     2687115 Aug  4 16:14 go/api/go1.1.txt
-rw-r--r--  0 0      0       30821 Aug  4 16:14 go/api/go1.10.txt
andrewkroh commented 1 year ago

The tar file issue is going to be fixed based on https://github.com/golang/go/issues/61862, but gvm could add its own handling for this problem.

dmitshur commented 1 year ago

For reference, including the ".0" in the Go version was Go proposal golang/go#57631 and it only applies to Go 1.21.0 and newer, not older releases. Also worth noting that proposal golang/go#32450 was closed in its place to reassert commitment to the current new pattern, so it's unlikely to change again anytime soon.

rsc commented 1 year ago

Also worth noting that Go 1.21.0 now has gvm-like functionality built in. See https://go.dev/doc/toolchain.