diff --git a/command/debug/debug.go b/command/debug/debug.go index d6592ed5a5..36a8ae3662 100644 --- a/command/debug/debug.go +++ b/command/debug/debug.go @@ -610,7 +610,7 @@ func (c *cmd) createArchiveTemp(path string) (tempName string, err error) { } g := gzip.NewWriter(f) - t := tar.NewWriter(f) + t := tar.NewWriter(g) tempName = f.Name() diff --git a/command/debug/debug_test.go b/command/debug/debug_test.go index 071e9fbbcb..839fc2578f 100644 --- a/command/debug/debug_test.go +++ b/command/debug/debug_test.go @@ -2,6 +2,7 @@ package debug import ( "archive/tar" + "compress/gzip" "fmt" "io" "os" @@ -94,7 +95,11 @@ func TestDebugCommand_Archive(t *testing.T) { if err != nil { 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 { h, err := tr.Next()