Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ASDF_GOLANG_SKIP_CHECKSUM to skip verifying checksum. #95

Merged
merged 1 commit into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ selected, not necessarily `1.14.patch`.
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
```

#### With ASDF_GOLANG_OVERWRITE_ARCH

```
> ASDF_GOLANG_OVERWRITE_ARCH=amd64 asdf install golang 1.15.8
Platform 'darwin' supported!
Expand All @@ -78,6 +81,11 @@ verifying checksum
checksum verified
```

## Skipping Checksums

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).
If you need to skip the checksum for some reason just set `ASDF_GOLANG_SKIP_CHECKSUM`.

## Contributing

Feel free to create an issue or pull request if you find a bug.
Expand Down
15 changes: 10 additions & 5 deletions bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ download_golang () {
fi

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

echo 'verifying checksum'
if ! check_shasum "${download_path}/archive.tar.gz" "${download_path}/archive.tar.gz.sha256"; then
fail "Authenticity of package archive can not be assured. Exiting."
if [ "unset" = "${ASDF_GOLANG_SKIP_CHECKSUM:-unset}" ]; then
curl "${download_url}.sha256" -o "${download_path}/archive.tar.gz.sha256"

echo 'verifying checksum'
if ! check_shasum "${download_path}/archive.tar.gz" "${download_path}/archive.tar.gz.sha256"; then
fail "Authenticity of package archive can not be assured. Exiting."
else
msg "checksum verified"
fi
else
msg "checksum verified"
err "checksum skipped"
fi
}

Expand Down