diff options
Diffstat (limited to 'src/pkg/path')
-rw-r--r-- | src/pkg/path/filepath/path.go | 7 | ||||
-rw-r--r-- | src/pkg/path/filepath/path_plan9.go | 2 | ||||
-rw-r--r-- | src/pkg/path/filepath/path_test.go | 26 |
3 files changed, 32 insertions, 3 deletions
diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index a4e429bae..815021bd0 100644 --- a/src/pkg/path/filepath/path.go +++ b/src/pkg/path/filepath/path.go @@ -320,8 +320,11 @@ func walk(path string, info os.FileInfo, walkFn WalkFunc) error { } for _, fileInfo := range list { - if err = walk(Join(path, fileInfo.Name()), fileInfo, walkFn); err != nil { - return err + err = walk(Join(path, fileInfo.Name()), fileInfo, walkFn) + if err != nil { + if !fileInfo.IsDir() || err != SkipDir { + return err + } } } return nil diff --git a/src/pkg/path/filepath/path_plan9.go b/src/pkg/path/filepath/path_plan9.go index cf028a75c..59a5812dd 100644 --- a/src/pkg/path/filepath/path_plan9.go +++ b/src/pkg/path/filepath/path_plan9.go @@ -12,7 +12,7 @@ func IsAbs(path string) bool { } // VolumeName returns the leading volume name on Windows. -// It returns "" elsewhere +// It returns "" elsewhere. func VolumeName(path string) string { return "" } diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go index b8766588c..070905fd3 100644 --- a/src/pkg/path/filepath/path_test.go +++ b/src/pkg/path/filepath/path_test.go @@ -869,3 +869,29 @@ func TestDriveLetterInEvalSymlinks(t *testing.T) { t.Errorf("Results of EvalSymlinks do not match: %q and %q", flp, fup) } } + +func TestBug3486(t *testing.T) { // http://code.google.com/p/go/issues/detail?id=3486 + root, err := filepath.EvalSymlinks(os.Getenv("GOROOT")) + if err != nil { + t.Fatal(err) + } + lib := filepath.Join(root, "lib") + src := filepath.Join(root, "src") + seenSrc := false + filepath.Walk(root, func(pth string, info os.FileInfo, err error) error { + if err != nil { + t.Fatal(err) + } + + switch pth { + case lib: + return filepath.SkipDir + case src: + seenSrc = true + } + return nil + }) + if !seenSrc { + t.Fatalf("%q not seen", src) + } +} |