Skip to content

Commit

Permalink
Don't defer unknown errors
Browse files Browse the repository at this point in the history
  • Loading branch information
the-maldridge committed Apr 17, 2021
1 parent 3364916 commit d6eb41b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ func fetch(url string) ([]byte, int, error) {
c := http.Client{Timeout: time.Second * 10}

resp, err := c.Get(url)
defer resp.Body.Close()
if err != nil {
return nil, 0, err
}
defer resp.Body.Close()

bytes, err := ioutil.ReadAll(resp.Body)
return bytes, resp.StatusCode, err
Expand Down

0 comments on commit d6eb41b

Please sign in to comment.