1
0
mirror of https://github.com/golang/go synced 2024-11-25 14:07:56 -07: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:
Dmitry Chestnykh 2011-11-07 16:33:53 +11:00 committed by Andrew Gerrand
parent 75af79b9b5
commit ad0e8b31d8
2 changed files with 6 additions and 1 deletions

View File

@ -60,6 +60,7 @@ func OpenReader(name string) (*ReadCloser, error) {
f.Close() f.Close()
return nil, err return nil, err
} }
r.f = f
return r, nil return r, nil
} }

View File

@ -98,7 +98,11 @@ func readTestZip(t *testing.T, zt ZipTest) {
if err == FormatError { if err == FormatError {
return 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 // bail here if no Files expected to be tested
// (there may actually be files in the zip, but we don't care) // (there may actually be files in the zip, but we don't care)