Skip to content

Commit

Permalink
Add ASDF_GOLANG_SKIP_CHECKSUM to skip verifying checksum. (#95)
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
kennyp authored Dec 17, 2022
1 parent c38b6d3 commit f006a12
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
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

0 comments on commit f006a12

Please sign in to comment.