Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check err before using file object
If there is an error downloading a release archive from Hashicorp, the `zipFile` variable will be `nil` and cause a panic on the deferred call to `os.Remove` due to a nil pointer dereference. This hides the underlying error and prevents the user from knowing what the actual problem is in downloading the release archive. This change moves the order of operations around to check if there is an error returned by `downloadReleaseArchive` first before using the `zipFile` variable. In the case that there was a problem downloading the release archive from Hashicorp this function should return the originating error and not mask it with a nil pointer dereference.
- Loading branch information