From ce5909dafcd21d0e59e31839f69d9e56d6c164a7 Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Fri, 25 Aug 2023 12:36:39 -0600 Subject: [PATCH] release/dist: remove extra Close on a signed file (#9094) We pass the file as an io.Reader to http.Post under the hood as request body. Post, helpfully, detects that the body is an io.Closer and closes it. So when we try to explicitly close it again, we get "file already closed" error. The Close there is not load-bearing, we have a defer for it anyway. Remove the explicit close and error check. Updates #cleanup Signed-off-by: Andrew Lytvynov --- release/dist/dist.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/release/dist/dist.go b/release/dist/dist.go index 95225e470..2eb6dbc48 100644 --- a/release/dist/dist.go +++ b/release/dist/dist.go @@ -45,9 +45,6 @@ func (s Signer) SignFile(filePath, sigPath string) error { if err != nil { return err } - if err := f.Close(); err != nil { - return err - } return os.WriteFile(sigPath, sig, 0644) }