From 2c6646c4c39fedb23f724c98a8d83970b35cee37 Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Fri, 21 Aug 2020 21:34:45 -0700 Subject: [PATCH] release: fix adding libgeos files to .tar.gz and compress .zip * Fix issue where only the first file was added to a .tar.gz. * Compress files better when adding to zips. Release note: None --- pkg/release/release.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/release/release.go b/pkg/release/release.go index 32efcd062cef..dba48599f113 100644 --- a/pkg/release/release.go +++ b/pkg/release/release.go @@ -421,6 +421,7 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) { log.Fatal(err) } zipHeader.Name = filepath.Join(targetArchiveBase, f.ArchiveFilePath) + zipHeader.Method = zip.Deflate zfw, err := zw.CreateHeader(zipHeader) if err != nil { @@ -435,8 +436,8 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) { } } else { gzw := gzip.NewWriter(&body) + tw := tar.NewWriter(gzw) for _, f := range o.Files { - tw := tar.NewWriter(gzw) file, err := os.Open(f.LocalAbsolutePath) if err != nil { @@ -462,9 +463,9 @@ func PutRelease(svc S3Putter, o PutReleaseOptions) { if _, err := io.Copy(tw, file); err != nil { log.Fatal(err) } - if err := tw.Close(); err != nil { - log.Fatal(err) - } + } + if err := tw.Close(); err != nil { + log.Fatal(err) } if err := gzw.Close(); err != nil { log.Fatal(err)