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()
return nil, err
}
r.f = f
return r, nil
}

View file

@ -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)