File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"archive/zip"
5
+ "compress/flate"
5
6
"crypto/sha256"
6
7
"encoding/hex"
7
8
"errors"
@@ -15,6 +16,7 @@ import (
15
16
16
17
const (
17
18
checksumFilename = "SHA256SUMS.txt"
19
+ deflateLevel = 6
18
20
dirPerms = 0o755
19
21
distDir = "dist"
20
22
filePerms = 0o644
@@ -159,6 +161,9 @@ func zipDirectory(zipPath, dirPath string) error {
159
161
defer zipFile .Close ()
160
162
161
163
zipWriter := zip .NewWriter (zipFile )
164
+ zipWriter .RegisterCompressor (zip .Deflate , func (out io.Writer ) (io.WriteCloser , error ) {
165
+ return flate .NewWriter (out , deflateLevel )
166
+ })
162
167
defer zipWriter .Close ()
163
168
164
169
err = filepath .Walk (dirPath , func (path string , info fs.FileInfo , err error ) error {
@@ -221,7 +226,7 @@ func appendChecksum(checksumFilePath, filePath string) error {
221
226
222
227
relPath , err := filepath .Rel (filepath .Dir (checksumFilePath ), filePath )
223
228
if err != nil {
224
- return fmt .Errorf ("failed to get relative path: %v" , err )
229
+ return fmt .Errorf ("failed to get relative path: %v" , err )
225
230
}
226
231
checksumLine := fmt .Sprintf ("%s %s\n " , hash , relPath )
227
232
You can’t perform that action at this time.
0 commit comments