Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
a78a25a1
Commit
a78a25a1
authored
Apr 01, 2011
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path/filepath.Glob: don't drop known matches on error.
Fixes #1610. R=rsc CC=golang-dev
https://golang.org/cl/4355042
parent
73178643
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
match.go
src/pkg/path/filepath/match.go
+12
-9
No files found.
src/pkg/path/filepath/match.go
View file @
a78a25a1
...
...
@@ -241,37 +241,40 @@ func Glob(pattern string) (matches []string) {
}
// glob searches for files matching pattern in the directory dir
// and appends them to matches.
func
glob
(
dir
,
pattern
string
,
matches
[]
string
)
[]
string
{
// and appends them to matches. If the directory cannot be
// opened, it returns the existing matches. New matches are
// added in lexicographical order.
func
glob
(
dir
,
pattern
string
,
matches
[]
string
)
(
m
[]
string
)
{
m
=
matches
fi
,
err
:=
os
.
Stat
(
dir
)
if
err
!=
nil
{
return
nil
return
}
if
!
fi
.
IsDirectory
()
{
return
matches
return
}
d
,
err
:=
os
.
Open
(
dir
,
os
.
O_RDONLY
,
0666
)
if
err
!=
nil
{
return
nil
return
}
defer
d
.
Close
()
names
,
err
:=
d
.
Readdirnames
(
-
1
)
if
err
!=
nil
{
return
nil
return
}
sort
.
SortStrings
(
names
)
for
_
,
n
:=
range
names
{
matched
,
err
:=
Match
(
pattern
,
n
)
if
err
!=
nil
{
return
matches
break
}
if
matched
{
m
atches
=
append
(
matches
,
Join
(
dir
,
n
))
m
=
append
(
m
,
Join
(
dir
,
n
))
}
}
return
matches
return
}
// hasMeta returns true if path contains any of the magic characters
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment