mirror of
https://github.com/kennyp/asdf-golang.git
synced 2024-10-06 04:32:07 +08:00
fix: replace google with go url (#88)
Co-authored-by: julien <julien@undercurrent.tech>
This commit is contained in:
parent
cc8bc47d48
commit
ae1c810a85
15
README.md
15
README.md
@ -8,12 +8,12 @@ golang plugin for [asdf version manager](https://github.com/asdf-vm/asdf)
|
|||||||
|
|
||||||
### MacOS
|
### 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)
|
### Linux (Debian)
|
||||||
|
|
||||||
* [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `apt install coreutils`
|
- [GNU Core Utils](http://www.gnu.org/software/coreutils/coreutils.html) - `apt install coreutils`
|
||||||
* [curl](https://curl.haxx.se) - `apt install curl`
|
- [curl](https://curl.haxx.se) - `apt install curl`
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
@ -59,14 +59,17 @@ selected, not necessarily `1.14.patch`.
|
|||||||
The `ASDF_GOLANG_OVERWRITE_ARCH` variable can be used to override the architecture
|
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
|
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.
|
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
|
#### Without ASDF_GOLANG_OVERWRITE_ARCH
|
||||||
|
|
||||||
```
|
```
|
||||||
> asdf install golang 1.15.8
|
> asdf install golang 1.15.8
|
||||||
Platform 'darwin' supported!
|
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
|
#### With ASDF_GOLANG_OVERWRITE_ARCH
|
||||||
|
|
||||||
```
|
```
|
||||||
> ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.15.8
|
> ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.15.8
|
||||||
Platform 'darwin' supported!
|
Platform 'darwin' supported!
|
||||||
@ -84,8 +87,8 @@ Feel free to create an issue or pull request if you find a bug.
|
|||||||
|
|
||||||
## Issues
|
## Issues
|
||||||
|
|
||||||
* Assumes Linux, FreeBSD, or Mac
|
- Assumes Linux, FreeBSD, or Mac
|
||||||
* Assumes x86_64, i386, i686, armv6l, armv7l, arm64 and ppc64le
|
- Assumes x86_64, i386, i686, armv6l, armv7l, arm64 and ppc64le
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ download_golang () {
|
|||||||
|
|
||||||
platform=$(get_platform)
|
platform=$(get_platform)
|
||||||
arch=$(get_arch)
|
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")
|
http_code=$(curl -I -w '%{http_code}' -s -o /dev/null "$download_url")
|
||||||
if [ "$http_code" -eq 404 ] || [ "$http_code" -eq 403 ]; then
|
if [ "$http_code" -eq 404 ] || [ "$http_code" -eq 403 ]; then
|
||||||
|
@ -15,7 +15,7 @@ version=""
|
|||||||
|
|
||||||
for (( i=${#VERSIONS[@]}-1; i>=0; i-- )); do
|
for (( i=${#VERSIONS[@]}-1; i>=0; i-- )); do
|
||||||
version="${VERSIONS[i]}"
|
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")
|
http_code=$(curl -I -w '%{http_code}' -s -o /dev/null "$download_url")
|
||||||
if [ "$http_code" -ne 404 ] && [ "$http_code" -ne 403 ]; then
|
if [ "$http_code" -ne 404 ] && [ "$http_code" -ne 403 ]; then
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user