There are a few missing, and a few that don't happen on error cases.
I did include whitespace changes to have defer resp.Body.Close() in the same stanza as resp, err := ... while manually reviewing, before realizing "there must be a linter to do this for me".
While this isn't conclusively #20 , unclosed HTTP connections are a common cause of memory issues.
Enable the https://github.com/timakin/bodyclose linter, and fix issues it raises.
There are a few missing, and a few that don't happen on error cases. I did include whitespace changes to have
defer resp.Body.Close()
in the same stanza asresp, err := ...
while manually reviewing, before realizing "there must be a linter to do this for me".While this isn't conclusively #20 , unclosed HTTP connections are a common cause of memory issues.