From da152ef1a007761b5c7070ecd8cdef7a6d652145 Mon Sep 17 00:00:00 2001 From: Bob Matcuk Date: Fri, 11 Oct 2024 09:11:05 -0400 Subject: [PATCH] add docs for MatchUnvalidated, PathMatchUnvalidated --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index f4e23c4..21929a9 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,19 @@ Note: users should _not_ count on the returned error, `doublestar.ErrBadPattern`, being equal to `path.ErrBadPattern`. +### MatchUnvalidated + +```go +func MatchUnvalidated(pattern, name string) bool +``` + +MatchUnvalidated can provide a small performance improvement if you don't care +about whether or not the pattern is valid (perhaps because you already ran +`ValidatePattern`). Note that there's really only one case where this +performance improvement is realized: when pattern matching reaches the end of +`name` before reaching the end of `pattern`, such as `Match("a/b/c", "a")`. + + ### PathMatch ```go @@ -105,6 +118,20 @@ that both `pattern` and `name` are using the system's path separator. If you can't be sure of that, use `filepath.ToSlash()` on both `pattern` and `name`, and then use the `Match()` function instead. + +### PathMatchUnvalidated + +```go +func PathMatchUnvalidated(pattern, name string) bool +``` + +PathMatchUnvalidated can provide a small performance improvement if you don't +care about whether or not the pattern is valid (perhaps because you already ran +`ValidatePattern`). Note that there's really only one case where this +performance improvement is realized: when pattern matching reaches the end of +`name` before reaching the end of `pattern`, such as `Match("a/b/c", "a")`. + + ### GlobOption Options that may be passed to `Glob`, `GlobWalk`, or `FilepathGlob`. Any number