kevincobain2000 / gobrew

Go version manager, written in Go. Super simple tool to install and manage Go versions. Install go without root. Gobrew doesn't require shell rehash.
https://medium.com/web-developer/go-version-manager-gobrew-c8750157dfe6
MIT License
364 stars 24 forks source link

Specifying an invalid version returns success #105

Closed jaxxstorm closed 1 year ago

jaxxstorm commented 1 year ago
[Info] Downloading version: 1.20.8
[Info] Downloading from: https://golang.org/dl/go1.20.8.darwin-arm64.tar.gz
[Info] Downloading to: /Users/lbriggs/.gobrew/downloads
[Info] Downloading file go1.20.8.darwin-arm64.tar.gz from https://golang.org/dl/go1.20.8.darwin-arm64.tar.gz
0%
[Info] Download completed in 2.012692375s[Info] Extracting from: /Users/lbriggs/.gobrew/downloads/go1.20.8.darwin-arm64.tar.gz
[Info] Extracting to: /Users/lbriggs/.gobrew/versions/1.20.8
[Success] Untar to /Users/lbriggs/.gobrew/versions/1.20.8
[Success] Downloaded version: 1.20.8

Obviously there's no 1.20.8 of go, so the download should fail

kevincobain2000 commented 1 year ago

lol

kevincobain2000 commented 1 year ago

hmmm for me it is as below:

╰─$ go run cmd/gobrew/main.go use 1.20.8
==> [Info] Downloading version: 1.20.8
==> [Info] Downloading from: https://go.dev/dl/go1.20.8.darwin-arm64.tar.gz
==> [Info] Downloading to: /Users/pulkit.kathuria/.gobrew/downloads
404 <--- debug status code
==> [Info] Downloading version failed: https://go.dev/dl/go1.20.8.darwin-arm64.tar.gz returned status code 404
==> [Error]: Please check connectivity to url: https://go.dev/dl/go1.20.8.darwin-arm64.tar.gz

What version of gobrew version are you on?

kevincobain2000 commented 1 year ago

I think you are on an older version because [Info] Downloading from: https://golang.org/dl/go1.20.8.darwin-arm64.tar.gz

The current defaultRegistryPath is go.dev which provides correct status code https://github.com/kevincobain2000/gobrew/blob/c0cd7e92b6de254857dc2840773ae2360af300c1/gobrew.go#L24