// Match returns true is path matches the filter
Match returns true is path matches the filter
// Match returns true is path matches the filter
func (filter *PathFilter) Match(path string) (result bool) {
	maskIndex, pathIndex := 0, 0
	pathSlice := strings.Split(path, ".")
	maskSlice := filter.mask
	for maskIndex < len(maskSlice) && pathIndex < len(pathSlice) {
		if pathSlice[pathIndex] != maskSlice[maskIndex] && maskSlice[maskIndex] != "*" {
			return false
		}
		if maskSlice[maskIndex] == "*" {
			if pathIndex < len(pathSlice)-1 &&
				maskIndex < len(maskSlice)-1 &&
				pathSlice[pathIndex+1] != maskSlice[maskIndex+1] &&
				maskSlice[maskIndex+1] != "*" {
				pathIndex++
				continue
			}
		}
		pathIndex++
		maskIndex++
	}
	if maskIndex != len(maskSlice) {
		return false
	}
	return true
}
func ( filter * PathFilter ) Match ( path string ) ( result bool ) { maskIndex , pathIndex := 0 , 0 pathSlice := strings . Split ( path , " " ) maskSlice := filter . mask for maskIndex < len ( maskSlice ) && pathIndex < len ( pathSlice ) { if pathSlice [ pathIndex ] != maskSlice [ maskIndex ] && maskSlice [ maskIndex ] != " " { return false } if maskSlice [ maskIndex ] == " " { if pathIndex < len ( pathSlice ) - 1 && maskIndex < len ( maskSlice ) - 1 && pathSlice [ pathIndex + 1 ] != maskSlice [ maskIndex + 1 ] && maskSlice [ maskIndex + 1 ] != " " { pathIndex ++ continue } } pathIndex ++ maskIndex ++ } if maskIndex != len ( maskSlice ) { return false } return true }
Match returns true is path matches the filter
Match returns true is path matches the filter