1
0
mirror of https://github.com/golang/go synced 2024-11-07 15:26:11 -07:00

cmd/go/internal/modfetch: do not panic when zip is incorrect from GOPROXY

If GOPROXY sends the wrong zip data when cmd/go asks for a module's zip ball,
we should not panic. zip.OpenReader always returns a nil ReadCLoser if err is not nil.

Therefore, it's Okay to remove zip.Close in the err block.

Fixes #26536
This commit is contained in:
marwan-at-work 2018-07-22 16:07:09 -04:00
parent 48c79734ff
commit 88040a9edb

View File

@ -90,7 +90,6 @@ func downloadZip(mod module.Version, target string) error {
// Double-check zip file looks OK.
z, err := zip.OpenReader(tmpfile)
if err != nil {
z.Close()
return err
}
prefix := mod.Path + "@" + mod.Version