diff options
| author | Rob Pike <r@golang.org> | 2010-04-09 11:36:40 -0700 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2010-04-09 11:36:40 -0700 |
| commit | 3ddeef81532df116ce4e8fd02fec68a3c2063d65 (patch) | |
| tree | 785f97a877212b48c850995c21974f912e13bba3 /src/pkg/path | |
| parent | a17544f2832fe00e8d32d45215b37bc8ee6c10a5 (diff) | |
| download | go-3ddeef81532df116ce4e8fd02fec68a3c2063d65.tar.xz | |
rename os.Dir to os.FileInfo
R=rsc
CC=golang-dev
https://golang.org/cl/902042
Diffstat (limited to 'src/pkg/path')
| -rw-r--r-- | src/pkg/path/path.go | 16 | ||||
| -rw-r--r-- | src/pkg/path/path_test.go | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/pkg/path/path.go b/src/pkg/path/path.go index 71d8b42158..86bfe64555 100644 --- a/src/pkg/path/path.go +++ b/src/pkg/path/path.go @@ -143,17 +143,17 @@ func Ext(path string) string { // visited by Walk. The parameter path is the full path of d relative // to root. type Visitor interface { - VisitDir(path string, d *os.Dir) bool - VisitFile(path string, d *os.Dir) + VisitDir(path string, f *os.FileInfo) bool + VisitFile(path string, f *os.FileInfo) } -func walk(path string, d *os.Dir, v Visitor, errors chan<- os.Error) { - if !d.IsDirectory() { - v.VisitFile(path, d) +func walk(path string, f *os.FileInfo, v Visitor, errors chan<- os.Error) { + if !f.IsDirectory() { + v.VisitFile(path, f) return } - if !v.VisitDir(path, d) { + if !v.VisitDir(path, f) { return // skip directory entries } @@ -177,12 +177,12 @@ func walk(path string, d *os.Dir, v Visitor, errors chan<- os.Error) { // If errors != nil, Walk sends each directory read error // to the channel. Otherwise Walk discards the error. func Walk(root string, v Visitor, errors chan<- os.Error) { - d, err := os.Lstat(root) + f, err := os.Lstat(root) if err != nil { if errors != nil { errors <- err } return // can't progress } - walk(root, d, v, errors) + walk(root, f, v, errors) } diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go index cd5978c156..e2458f20c4 100644 --- a/src/pkg/path/path_test.go +++ b/src/pkg/path/path_test.go @@ -224,13 +224,13 @@ func mark(name string) { type TestVisitor struct{} -func (v *TestVisitor) VisitDir(path string, d *os.Dir) bool { - mark(d.Name) +func (v *TestVisitor) VisitDir(path string, f *os.FileInfo) bool { + mark(f.Name) return true } -func (v *TestVisitor) VisitFile(path string, d *os.Dir) { - mark(d.Name) +func (v *TestVisitor) VisitFile(path string, f *os.FileInfo) { + mark(f.Name) } func TestWalk(t *testing.T) { |
