parent
2b884d194e
commit
7831e0c08c
|
@ -53,22 +53,19 @@ func DirToBox(dst, dir string, ui packer.Ui, level int) error {
|
||||||
}
|
}
|
||||||
defer dstF.Close()
|
defer dstF.Close()
|
||||||
|
|
||||||
var tarOrGzipWriter io.Writer
|
var dstWriter io.Writer = dstF
|
||||||
|
|
||||||
if level != flate.NoCompression {
|
if level != flate.NoCompression {
|
||||||
log.Printf("Compressing with gzip compression level %v", level)
|
log.Printf("Compressing with gzip compression level: %d", level)
|
||||||
gzipWriter, err := gzip.NewWriterLevel(dstF, level)
|
gzipWriter, err := gzip.NewWriterLevel(dstWriter, level)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer gzipWriter.Close()
|
defer gzipWriter.Close()
|
||||||
tarOrGzipWriter = gzipWriter
|
|
||||||
} else {
|
dstWriter = gzipWriter
|
||||||
log.Printf("Skipping gzip compression")
|
|
||||||
tarOrGzipWriter = dstF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tarWriter := tar.NewWriter(tarOrGzipWriter)
|
tarWriter := tar.NewWriter(dstWriter)
|
||||||
defer tarWriter.Close()
|
defer tarWriter.Close()
|
||||||
|
|
||||||
// This is the walk func that tars each of the files in the dir
|
// This is the walk func that tars each of the files in the dir
|
||||||
|
|
Loading…
Reference in New Issue