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

Core tool downloader fixes #1028

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Core tool downloader fixes #1028

merged 1 commit into from
Dec 5, 2024

Conversation

ofalvai
Copy link
Contributor

@ofalvai ofalvai commented Dec 5, 2024

Checklist

Version

Requires a MAJOR/MINOR/PATCH version update

Context

Changes

Investigation details

Decisions

return fmt.Errorf("failed to download from (%s), error: %s", downloadURL, err)
return fmt.Errorf("download %s: %s", downloadURL, err)
}
if resp.StatusCode >= 400 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL net/http follows redirects by default, we should not see 3xx status codes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default retryablehttp config does close http response body https://github.com/hashicorp/go-retryablehttp/blob/9dfd949154e507c91ee569367ffa461991b80950/client.go#L811. closing it twice may not be an issue tough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's why the defer func is not above this error handling...at least this is how I understand the whole thing.

@ofalvai ofalvai merged commit 91e698e into master Dec 5, 2024
8 checks passed
@ofalvai ofalvai deleted the ofalvai/tool-retry branch December 5, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants