Merge pull request #188 from colincross/match
Export pathtools.Match
diff --git a/pathtools/glob.go b/pathtools/glob.go
index 38d96a0..367d219 100644
--- a/pathtools/glob.go
+++ b/pathtools/glob.go
@@ -177,7 +177,7 @@
matchLoop:
for _, m := range matches {
for _, e := range excludes {
- exclude, err := match(e, m)
+ exclude, err := Match(e, m)
if err != nil {
return nil, err
}
@@ -206,9 +206,9 @@
return ret
}
-// match returns true if name matches pattern using the same rules as filepath.Match, but supporting
+// Match returns true if name matches pattern using the same rules as filepath.Match, but supporting
// hierarchical patterns (a/*) and recursive globs (**).
-func match(pattern, name string) (bool, error) {
+func Match(pattern, name string) (bool, error) {
if filepath.Base(pattern) == "**" {
return false, GlobLastRecursiveErr
}
@@ -237,7 +237,7 @@
// matchPrefix returns true if the beginning of name matches pattern using the same rules as
// filepath.Match, but supporting hierarchical patterns (a/*). Recursive globs (**) are not
-// supported, they should have been handled in match().
+// supported, they should have been handled in Match().
func matchPrefix(pattern, name string) (bool, error) {
if len(pattern) > 0 && pattern[0] == '/' {
if len(name) > 0 && name[0] == '/' {