(path []string, isDir bool)
| 66 | } |
| 67 | |
| 68 | func (p *pattern) Match(path []string, isDir bool) MatchResult { |
| 69 | if len(path) <= len(p.domain) { |
| 70 | return NoMatch |
| 71 | } |
| 72 | for i, e := range p.domain { |
| 73 | if path[i] != e { |
| 74 | return NoMatch |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | path = path[len(p.domain):] |
| 79 | if p.isGlob && !p.globMatch(path, isDir) { |
| 80 | return NoMatch |
| 81 | } else if !p.isGlob && !p.simpleNameMatch(path, isDir) { |
| 82 | return NoMatch |
| 83 | } |
| 84 | |
| 85 | if p.inclusion { |
| 86 | return Include |
| 87 | } else { |
| 88 | return Exclude |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func (p *pattern) simpleNameMatch(path []string, isDir bool) bool { |
| 93 | for i, name := range path { |
nothing calls this directly
no test coverage detected