Example #1
0
func exclusionsForPattern(cfignorePattern string) (exclusions Globs) {
	exclusions = append(exclusions, glob.MustCompileGlob(cfignorePattern))
	exclusions = append(exclusions, glob.MustCompileGlob(path.Join(cfignorePattern, "*")))
	exclusions = append(exclusions, glob.MustCompileGlob(path.Join(cfignorePattern, "**", "*")))

	if !strings.HasPrefix(cfignorePattern, "/") {
		exclusions = append(exclusions, glob.MustCompileGlob(path.Join("**", cfignorePattern)))
		exclusions = append(exclusions, glob.MustCompileGlob(path.Join("**", cfignorePattern, "*")))
		exclusions = append(exclusions, glob.MustCompileGlob(path.Join("**", cfignorePattern, "**", "*")))
	}
	return
}
Example #2
0
func globsForPattern(pattern string) (globs []glob.Glob) {
	globs = append(globs, glob.MustCompileGlob(pattern))
	globs = append(globs, glob.MustCompileGlob(path.Join(pattern, "*")))
	globs = append(globs, glob.MustCompileGlob(path.Join(pattern, "**", "*")))

	if !strings.HasPrefix(pattern, "/") {
		globs = append(globs, glob.MustCompileGlob(path.Join("**", pattern)))
		globs = append(globs, glob.MustCompileGlob(path.Join("**", pattern, "*")))
		globs = append(globs, glob.MustCompileGlob(path.Join("**", pattern, "**", "*")))
	}

	return
}