Skip to content

Commit

Permalink
Merge pull request #181 from icholy/master
Browse files Browse the repository at this point in the history
defer file close in case io.Reader panics
  • Loading branch information
dnephin authored Dec 24, 2019
2 parents 8a08dad + 7dc86c4 commit a1378ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func WithReaderContent(r io.Reader) PathOp {
if err != nil {
return err
}
defer f.Close()
_, err = io.Copy(f, r)
f.Close()
return err
}
}
Expand Down

0 comments on commit a1378ce

Please sign in to comment.