Skip to content

Commit

Permalink
Merge pull request gocolly#71 from ferhatelmas/defer-fix
Browse files Browse the repository at this point in the history
[fix] close file after checking error in http backend
  • Loading branch information
asciimoo authored Dec 21, 2017
2 parents 2a4c533 + 5bc3bb6 commit 4352e22
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ func (h *httpBackend) Cache(request *http.Request, bodySize int, cacheDir string
}
}
file, err := os.Create(filename + "~")
defer file.Close()
if err != nil {
return resp, err
}
defer file.Close()
if err := gob.NewEncoder(file).Encode(resp); err != nil {
return resp, err
}
Expand Down

0 comments on commit 4352e22

Please sign in to comment.