summaryrefslogtreecommitdiff
path: root/src/path
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-18 21:50:22 -0400
committerRuss Cox <rsc@golang.org>2014-09-18 21:50:22 -0400
commitb193b7b7d9b3e7251af57619c28809dc7ad71237 (patch)
treebb87b6eaa16a532ab9a33468a5f4dd6daf10ad24 /src/path
parente6883258e6ce2551ed1e669f12211583a876608e (diff)
downloadgo-b193b7b7d9b3e7251af57619c28809dc7ad71237.tar.gz
path/filepath: document that Glob ignores i/o errors
Fixes issue 8008. LGTM=adg R=golang-codereviews, nightlyone, adg CC=golang-codereviews https://codereview.appspot.com/138630045
Diffstat (limited to 'src/path')
-rw-r--r--src/path/filepath/match.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/path/filepath/match.go b/src/path/filepath/match.go
index a9bcc103c..ecc07aa5d 100644
--- a/src/path/filepath/match.go
+++ b/src/path/filepath/match.go
@@ -228,6 +228,9 @@ func getEsc(chunk string) (r rune, nchunk string, err error) {
// as in Match. The pattern may describe hierarchical names such as
// /usr/*/bin/ed (assuming the Separator is '/').
//
+// Glob ignores file system errors such as I/O errors reading directories.
+// The only possible returned error is ErrBadPattern, when pattern
+// is malformed.
func Glob(pattern string) (matches []string, err error) {
if !hasMeta(pattern) {
if _, err = os.Lstat(pattern); err != nil {
@@ -283,10 +286,7 @@ func glob(dir, pattern string, matches []string) (m []string, e error) {
}
defer d.Close()
- names, err := d.Readdirnames(-1)
- if err != nil {
- return
- }
+ names, _ := d.Readdirnames(-1)
sort.Strings(names)
for _, n := range names {