mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
archive/zip: actually close file opened with OpenReader.
R=golang-dev, adg CC=golang-dev https://golang.org/cl/5341044
This commit is contained in:
parent
75af79b9b5
commit
ad0e8b31d8
|
@ -60,6 +60,7 @@ func OpenReader(name string) (*ReadCloser, error) {
|
|||
f.Close()
|
||||
return nil, err
|
||||
}
|
||||
r.f = f
|
||||
return r, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,11 @@ func readTestZip(t *testing.T, zt ZipTest) {
|
|||
if err == FormatError {
|
||||
return
|
||||
}
|
||||
defer z.Close()
|
||||
defer func() {
|
||||
if err := z.Close(); err != nil {
|
||||
t.Errorf("error %q when closing zip file", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// bail here if no Files expected to be tested
|
||||
// (there may actually be files in the zip, but we don't care)
|
||||
|
|
Loading…
Reference in a new issue