-
Notifications
You must be signed in to change notification settings - Fork 849
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
Check errors #431
Check errors #431
Changes from 9 commits
8285212
6eb4fe0
00a0145
40fb143
7478058
e01c89c
f177877
a7de7ad
1c94249
9ca7400
9048767
ef112da
bf23f32
ef160cf
f7e4e42
3fa71a0
3b3aa5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ import ( | |
"net/http" | ||
) | ||
|
||
func getResponseBody(response *http.Response) ([]byte, error) { | ||
defer response.Body.Close() | ||
func getResponseBody(response *http.Response) (out []byte, err error) { | ||
defer func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not super ok with this one 1) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm returning named results so the errors inside the defer function can actually be returned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
it will panic with nil dereference error. |
||
err = response.Body.Close() | ||
}() | ||
return ioutil.ReadAll(response.Body) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be shortened:
set -e; for v in ./arm... ./datalake-store/... ./Gododir/...; do errcheck -ignoretests "$v"; done