From ae1c810a85b2a673fe0767e720d1381aed82f46c Mon Sep 17 00:00:00 2001 From: Julien Bongars Date: Sat, 17 Dec 2022 12:32:12 +0800 Subject: [PATCH] fix: replace google with go url (#88) Co-authored-by: julien --- README.md | 19 +++++++++++-------- bin/download | 2 +- bin/latest-stable | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2330d10..c112d29 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bin/download b/bin/download index 81d4930..2c10d16 100755 --- a/bin/download +++ b/bin/download @@ -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 diff --git a/bin/latest-stable b/bin/latest-stable index 0b11812..4326c4d 100755 --- a/bin/latest-stable +++ b/bin/latest-stable @@ -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