fix: replace google with go url (#88)

Co-authored-by: julien <julien@undercurrent.tech>
This commit is contained in:
Julien Bongars 2022-12-17 12:32:12 +08:00 committed by GitHub
parent cc8bc47d48
commit ae1c810a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -8,12 +8,12 @@ golang plugin for [asdf version manager](https://github.com/asdf-vm/asdf)
### MacOS
* [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `brew install coreutils`
- [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `brew install coreutils`
### Linux (Debian)
* [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `apt install coreutils`
* [curl](https://curl.haxx.se) - `apt install curl`
- [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `apt install coreutils`
- [curl](https://curl.haxx.se) - `apt install curl`
## Install
@ -56,17 +56,20 @@ selected, not necessarily `1.14.patch`.
## Architecture Override
The `ASDF_GOLANG_OVERWRITE_ARCH` variable can be used to override the architecture
that is used for determining which Go build to download. The primary use case is when attempting
The `ASDF_GOLANG_OVERWRITE_ARCH` variable can be used to override the architecture
that is used for determining which Go build to download. The primary use case is when attempting
to install an older version of Go for use on an Apple M1 computer as Go was not being built for ARM at the time.
#### Without ASDF_GOLANG_OVERWRITE_ARCH
```
> asdf install golang 1.15.8
Platform 'darwin' supported!
URL: https://dl.google.com/go/go1.15.8.darwin-arm64.tar.gz returned status 404
URL: https://go.dev/dl/go1.15.8.darwin-arm64.tar.gz returned status 404
```
#### With ASDF_GOLANG_OVERWRITE_ARCH
```
> ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.15.8
Platform 'darwin' supported!
@ -84,8 +87,8 @@ Feel free to create an issue or pull request if you find a bug.
## Issues
* Assumes Linux, FreeBSD, or Mac
* Assumes x86_64, i386, i686, armv6l, armv7l, arm64 and ppc64le
- Assumes Linux, FreeBSD, or Mac
- Assumes x86_64, i386, i686, armv6l, armv7l, arm64 and ppc64le
## License

View File

@ -34,7 +34,7 @@ download_golang () {
platform=$(get_platform)
arch=$(get_arch)
download_url="https://dl.google.com/go/go${version}.${platform}-${arch}.tar.gz"
download_url="https://go.dev/dl/go${version}.${platform}-${arch}.tar.gz"
http_code=$(curl -I -w '%{http_code}' -s -o /dev/null "$download_url")
if [ "$http_code" -eq 404 ] || [ "$http_code" -eq 403 ]; then

View File

@ -15,7 +15,7 @@ version=""
for (( i=${#VERSIONS[@]}-1; i>=0; i-- )); do
version="${VERSIONS[i]}"
download_url="https://dl.google.com/go/go${version}.${platform}-${arch}.tar.gz"
download_url="https://go.dev/dl/go${version}.${platform}-${arch}.tar.gz"
http_code=$(curl -I -w '%{http_code}' -s -o /dev/null "$download_url")
if [ "$http_code" -ne 404 ] && [ "$http_code" -ne 403 ]; then
break