Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions decompress.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Decompressor interface {
var Decompressors map[string]Decompressor

func init() {
tarDecompressor := new(TarDecompressor)
tbzDecompressor := new(TarBzip2Decompressor)
tgzDecompressor := new(TarGzipDecompressor)
txzDecompressor := new(TarXzDecompressor)
Expand All @@ -38,6 +39,8 @@ func init() {
"tgz": tgzDecompressor,
"txz": txzDecompressor,
"zip": new(ZipDecompressor),
"tar": tarDecompressor,
"ova": tarDecompressor,
}
}

Expand Down
6 changes: 3 additions & 3 deletions decompress_tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ func untar(input io.Reader, dst, src string, dir bool, umask os.FileMode) error
return nil
}

// tarDecompressor is an implementation of Decompressor that can
// TarDecompressor is an implementation of Decompressor that can
// unpack tar files.
type tarDecompressor struct{}
type TarDecompressor struct{}

func (d *tarDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error {
func (d *TarDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error {
// If we're going into a directory we should make that first
mkdir := dst
if !dir {
Expand Down
4 changes: 2 additions & 2 deletions decompress_tar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestTar(t *testing.T) {
cases[i].Input = filepath.Join("./testdata", "decompress-tar", tc.Input)
}

TestDecompressor(t, new(tarDecompressor), cases)
TestDecompressor(t, new(TarDecompressor), cases)
}

// testDecompressPermissions decompresses a directory and checks the permissions of the expanded files
Expand Down Expand Up @@ -76,7 +76,7 @@ func testDecompressorPermissions(t *testing.T, d Decompressor, input string, exp
}

func TestDecompressTarPermissions(t *testing.T) {
d := new(tarDecompressor)
d := new(TarDecompressor)
input := "./test-fixtures/decompress-tar/permissions.tar"

var expected map[string]int
Expand Down