Skip to content

Commit

Permalink
Use idiomatic defer
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Sep 26, 2023
1 parent f16734d commit efb5738
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions examples/scrape/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ func (s *Scraper) scrape(url string) ([]string, error) {
if err != nil {
return nil, err
}
defer func() {
res.Body.Close()
}()
defer res.Body.Close()

body, err := io.ReadAll(res.Body)
if err != nil {
Expand Down

0 comments on commit efb5738

Please sign in to comment.