From 7f428a83312f0381282d2ae89ecb6b69c0a9594e Mon Sep 17 00:00:00 2001 From: itchyny Date: Thu, 5 May 2022 16:58:29 +0900 Subject: [PATCH] Use deflate algorithm for zip archives --- builder.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/builder.go b/builder.go index d71da50..057a4d9 100644 --- a/builder.go +++ b/builder.go @@ -148,13 +148,17 @@ func (bdr *builder) build() (string, error) { } } - var arch archiver.Archiver = &archiver.Zip{ - CompressionLevel: flate.DefaultCompression, - MkdirAll: true, - SelectiveCompression: true, - } - archiveFilePath := workDir + ".zip" - if !bdr.zipAlways && bdr.platform.os != "windows" && bdr.platform.os != "darwin" { + var arch archiver.Archiver + var archiveFilePath string + if bdr.zipAlways || bdr.platform.os == "windows" || bdr.platform.os == "darwin" { + arch = &archiver.Zip{ + CompressionLevel: flate.DefaultCompression, + MkdirAll: true, + SelectiveCompression: true, + FileMethod: archiver.Deflate, + } + archiveFilePath = workDir + ".zip" + } else { arch = &archiver.TarGz{ CompressionLevel: gzip.DefaultCompression, Tar: &archiver.Tar{