grafeas / voucher

🎟 Voucher creates attestations for Binary Authorization
Apache License 2.0
73 stars 20 forks source link

Bodyclose linter #46

Closed thepwagner closed 2 years ago

thepwagner commented 2 years ago

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 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.