From 88040a9edb0cb547a498cb8c8b662eb8729eb8bf Mon Sep 17 00:00:00 2001 From: marwan-at-work Date: Sun, 22 Jul 2018 16:07:09 -0400 Subject: [PATCH] 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 --- src/cmd/go/internal/modfetch/fetch.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go index 110312bbe0..375c3f1478 100644 --- a/src/cmd/go/internal/modfetch/fetch.go +++ b/src/cmd/go/internal/modfetch/fetch.go @@ -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