Skip to content

Commit 4016de0

Browse files
jackxbrittonianlancetaylor
authored andcommitted
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: 553fc26 GitHub-Pull-Request: #26435 Reviewed-on: https://go-review.googlesource.com/124635 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent d2f663c commit 4016de0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/path/filepath/path.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,13 @@ var SkipDir = errors.New("skip this directory")
341341
//
342342
// If there was a problem walking to the file or directory named by path, the
343343
// incoming error will describe the problem and the function can decide how
344-
// to handle that error (and Walk will not descend into that directory). If
345-
// an error is returned, processing stops. The sole exception is when the function
346-
// returns the special value SkipDir. If the function returns SkipDir when invoked
347-
// on a directory, Walk skips the directory's contents entirely.
348-
// If the function returns SkipDir when invoked on a non-directory file,
349-
// Walk skips the remaining files in the containing directory.
344+
// to handle that error (and Walk will not descend into that directory). In the
345+
// case of an error, the info argument will be nil. If an error is returned,
346+
// processing stops. The sole exception is when the function returns the special
347+
// value SkipDir. If the function returns SkipDir when invoked on a directory,
348+
// Walk skips the directory's contents entirely. If the function returns SkipDir
349+
// when invoked on a non-directory file, Walk skips the remaining files in the
350+
// containing directory.
350351
type WalkFunc func(path string, info os.FileInfo, err error) error
351352

352353
var lstat = os.Lstat // for testing

0 commit comments

Comments
 (0)