Skip to content

Commit

Permalink
return any error from Close if no other error has occurred
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne authored and bmatcuk committed Apr 25, 2020
1 parent 28ecce1 commit 39df92f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doublestar.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ func doGlob(vos OS, basedir, pattern string, matches []string) (m []string, e er
if err != nil {
return
}
defer dir.Close()
defer func() {
if err := dir.Close(); e == nil {
e = err
}
}()

files, err := dir.Readdir(-1)
if err != nil {
Expand Down

0 comments on commit 39df92f

Please sign in to comment.