Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from dsnet/master
Browse files Browse the repository at this point in the history
Update tarbz2.go to account for recent API changes
  • Loading branch information
mholt authored Jul 4, 2016
2 parents b74c2b4 + 9ac4cc4 commit ea17366
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tarbz2.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,10 @@ func TarBz2(tarbz2Path string, filePaths []string) error {
}
defer out.Close()

bz2Writer := bzip2.NewWriter(out)
bz2Writer, err := bzip2.NewWriter(out, nil)
if err != nil {
return fmt.Errorf("error compressing %s: %v", tarbz2Path, err)
}
defer bz2Writer.Close()

tarWriter := tar.NewWriter(bz2Writer)
@@ -37,7 +40,10 @@ func UntarBz2(source, destination string) error {
}
defer f.Close()

bz2r := bzip2.NewReader(f)
bz2r, err := bzip2.NewReader(f, nil)
if err != nil {
return fmt.Errorf("error decompressing %s: %v", source, err)
}
defer bz2r.Close()

return untar(tar.NewReader(bz2r), destination)

0 comments on commit ea17366

Please sign in to comment.