Skip to content

Commit

Permalink
ignore the close error as it's in a defer
Browse files Browse the repository at this point in the history
* this avoids naming the error in the func Api, and makes the function simpler in general
  • Loading branch information
azr committed Feb 7, 2019
1 parent 9d52b63 commit f0a5d0d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions get_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (g *HttpGetter) Get(dst string, u *url.URL) error {
return g.getSubdir(ctx, dst, source, subDir)
}

func (g *HttpGetter) GetFile(dst string, src *url.URL) (err error) {
func (g *HttpGetter) GetFile(dst string, src *url.URL) error {
ctx := g.Context()
if g.Netrc {
// Add auth from netrc if we can
Expand All @@ -146,12 +146,7 @@ func (g *HttpGetter) GetFile(dst string, src *url.URL) (err error) {
if err != nil {
return err
}
defer func() {
cerr := f.Close()
if err == nil {
err = cerr
}
}()
defer f.Close()

if g.Client == nil {
g.Client = httpClient
Expand Down

0 comments on commit f0a5d0d

Please sign in to comment.