pkg/tar: tar_test.go - fixing possible nil pointer dereference

Playing a little with tar.go caused a panic in tar_test.go. This fixes it.
This commit is contained in:
gprggr
2014-12-30 13:23:59 +01:00
parent 1f931cc3ca
commit 76bacb4556
+6 -2
View File
@@ -207,11 +207,15 @@ func TestExtractTarFolders(t *testing.T) {
}
dirInfo, err := os.Lstat(filepath.Join(tmpdir, "deep/folder"))
if dirInfo.Mode().Perm() != os.FileMode(0747) {
if err != nil {
t.Errorf("unexpected error: %v", err)
} else if dirInfo.Mode().Perm() != os.FileMode(0747) {
t.Errorf("unexpected dir mode: %s", dirInfo.Mode())
}
dirInfo, err = os.Lstat(filepath.Join(tmpdir, "deep/deep"))
if dirInfo.Mode().Perm() != os.FileMode(0747) {
if err != nil {
t.Errorf("unexpected error: %v", err)
} else if dirInfo.Mode().Perm() != os.FileMode(0747) {
t.Errorf("unexpected dir mode: %s", dirInfo.Mode())
}