Skip to content

Commit f006a12

Browse files
authored
Add ASDF_GOLANG_SKIP_CHECKSUM to skip verifying checksum. (#95)
Update README
1 parent c38b6d3 commit f006a12

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,17 @@ selected, not necessarily `1.14.patch`.
5959
The `ASDF_GOLANG_OVERWRITE_ARCH` variable can be used to override the architecture
6060
that is used for determining which Go build to download. The primary use case is when attempting
6161
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.
62+
6263
#### Without ASDF_GOLANG_OVERWRITE_ARCH
64+
6365
```
6466
> asdf install golang 1.15.8
6567
Platform 'darwin' supported!
6668
URL: https://dl.google.com/go/go1.15.8.darwin-arm64.tar.gz returned status 404
6769
```
6870

6971
#### With ASDF_GOLANG_OVERWRITE_ARCH
72+
7073
```
7174
> ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.15.8
7275
Platform 'darwin' supported!
@@ -78,6 +81,11 @@ verifying checksum
7881
checksum verified
7982
```
8083

84+
## Skipping Checksums
85+
86+
By default we try to verify the checksum of each install but ocassionally [that's not possible](https://github.com/kennyp/asdf-golang/issues/91).
87+
If you need to skip the checksum for some reason just set `ASDF_GOLANG_SKIP_CHECKSUM`.
88+
8189
## Contributing
8290

8391
Feel free to create an issue or pull request if you find a bug.

bin/download

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ download_golang () {
4242
fi
4343

4444
curl "$download_url" -o "${download_path}/archive.tar.gz"
45-
curl "${download_url}.sha256" -o "${download_path}/archive.tar.gz.sha256"
4645

47-
echo 'verifying checksum'
48-
if ! check_shasum "${download_path}/archive.tar.gz" "${download_path}/archive.tar.gz.sha256"; then
49-
fail "Authenticity of package archive can not be assured. Exiting."
46+
if [ "unset" = "${ASDF_GOLANG_SKIP_CHECKSUM:-unset}" ]; then
47+
curl "${download_url}.sha256" -o "${download_path}/archive.tar.gz.sha256"
48+
49+
echo 'verifying checksum'
50+
if ! check_shasum "${download_path}/archive.tar.gz" "${download_path}/archive.tar.gz.sha256"; then
51+
fail "Authenticity of package archive can not be assured. Exiting."
52+
else
53+
msg "checksum verified"
54+
fi
5055
else
51-
msg "checksum verified"
56+
err "checksum skipped"
5257
fi
5358
}
5459

0 commit comments

Comments
 (0)