Fixed gziping function for debug archive (#5184)

This commit is contained in:
Boris Popovschi 2019-01-03 17:39:58 +02:00 committed by Matt Keeler
parent 87763ac96b
commit 8831b043ab
2 changed files with 7 additions and 2 deletions

View File

@ -610,7 +610,7 @@ func (c *cmd) createArchiveTemp(path string) (tempName string, err error) {
} }
g := gzip.NewWriter(f) g := gzip.NewWriter(f)
t := tar.NewWriter(f) t := tar.NewWriter(g)
tempName = f.Name() tempName = f.Name()

View File

@ -2,6 +2,7 @@ package debug
import ( import (
"archive/tar" "archive/tar"
"compress/gzip"
"fmt" "fmt"
"io" "io"
"os" "os"
@ -94,7 +95,11 @@ func TestDebugCommand_Archive(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("failed to open archive: %s", err) t.Fatalf("failed to open archive: %s", err)
} }
tr := tar.NewReader(file) gz, err := gzip.NewReader(file)
if err != nil {
t.Fatalf("failed to read gzip archive: %s", err)
}
tr := tar.NewReader(gz)
for { for {
h, err := tr.Next() h, err := tr.Next()