aboutsummaryrefslogtreecommitdiff
path: root/src/path
diff options
context:
space:
mode:
authorJack <jackxbritton@gmail.com>2018-07-18 19:12:14 +0000
committerIan Lance Taylor <iant@golang.org>2018-07-18 19:53:37 +0000
commit4016de0daffd46087e9ee9dc994e39c257191b40 (patch)
tree2a23386fd802e5c39ac269c02d1120ec68098540 /src/path
parentd2f663c4f241b2f1318f5126c206436afaefdadd (diff)
downloadgo-4016de0daffd46087e9ee9dc994e39c257191b40.tar.gz
go-4016de0daffd46087e9ee9dc994e39c257191b40.zip
filepath: updates doc to give case where WalkFunc info arg may be nil
If a filepath.WalkFunc is called with an non-nil err argument, it's possible that the info argument will be nil. The comment above filepath.WalkFunc now reflects this. Fixes #26425 Change-Id: Ib9963b3344587d2993f1698c5a801f2d1286856b GitHub-Last-Rev: 553fc266b570d0c47efe12b3b670f88112e3b334 GitHub-Pull-Request: golang/go#26435 Reviewed-on: https://go-review.googlesource.com/124635 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/path')
-rw-r--r--src/path/filepath/path.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
index 87f8faf21a..1508137a33 100644
--- a/src/path/filepath/path.go
+++ b/src/path/filepath/path.go
@@ -341,12 +341,13 @@ var SkipDir = errors.New("skip this directory")
//
// If there was a problem walking to the file or directory named by path, the
// incoming error will describe the problem and the function can decide how
-// to handle that error (and Walk will not descend into that directory). If
-// an error is returned, processing stops. The sole exception is when the function
-// returns the special value SkipDir. If the function returns SkipDir when invoked
-// on a directory, Walk skips the directory's contents entirely.
-// If the function returns SkipDir when invoked on a non-directory file,
-// Walk skips the remaining files in the containing directory.
+// to handle that error (and Walk will not descend into that directory). In the
+// case of an error, the info argument will be nil. If an error is returned,
+// processing stops. The sole exception is when the function returns the special
+// value SkipDir. If the function returns SkipDir when invoked on a directory,
+// Walk skips the directory's contents entirely. If the function returns SkipDir
+// when invoked on a non-directory file, Walk skips the remaining files in the
+// containing directory.
type WalkFunc func(path string, info os.FileInfo, err error) error
var lstat = os.Lstat // for testing