Skip to content

Commit ef53e8a

Browse files
committed
Use the correct date for the files in the zip
1 parent 5ea4287 commit ef53e8a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"os"
1414
"os/exec"
1515
"sync"
16+
"time"
1617

1718
"github.com/pkg/errors"
1819
)
@@ -146,11 +147,16 @@ func (a *analyzer) storeError(err error) {
146147
}
147148

148149
func (a *analyzer) writeFile(zf *zipFile) error {
149-
f, err := a.zipWriter.Create(zf.name)
150+
header := &zip.FileHeader{
151+
Name: zf.name,
152+
Method: zip.Deflate,
153+
Modified: time.Now(),
154+
}
155+
w, err := a.zipWriter.CreateHeader(header)
150156
if err != nil {
151157
return errors.Wrap(err, "error creating "+zf.name+" in zip file")
152158
}
153-
_, err = f.Write(zf.contents)
159+
_, err = w.Write(zf.contents)
154160
if err != nil {
155161
return errors.Wrap(err, "error writing "+zf.name+" to zip file")
156162
}

0 commit comments

Comments
 (0)