func genIgnorePatternPermutations(in string) []string {
	var (
		out       []string
		remaining = []string{in}

		addedPatternWithoutStars bool
	)

	for len(remaining) != 0 {
		next := remaining[0]
		remaining = remaining[1:]

		// Split on the double-star separator; stop if no the pattern
		// does not contain any more double-star separators.
		parts := strings.Split(next, "/**/")
		if len(parts) == 1 {
			if !addedPatternWithoutStars {
				out = append(out, next)
				addedPatternWithoutStars = true
			}
			continue
		}

		// Push next to the the out list and append a list of patterns
		// to the remain list for the next run by sequentially
		// substituting each double star pattern with a slash. For
		// example if next is "a/**/b/**c" the generated patterns will
		// be:
		// - a/b/**/c
		// - a/**/b/c
		out = append(out, next)
		for i := 1; i < len(parts); i++ {
			remaining = append(
				remaining,
				strings.Join(parts[:i], "/**/")+"/"+strings.Join(parts[i:], "/**/"),
			)
		}
	}

	return out
}
// genIgnorePatternPermutations receives as input a string possibly containing
// one or more double-star separator patterns (/**/) and generates a list of
// additional glob patterns that allow matching zero-or-more items at the
// location of each double-star separator.
//
// For example, given "foo/**/bar/**/baz" as input, this function returns:
//   - foo/**/bar/**/baz
//   - foo/bar/**/baz
//   - foo/**/bar/baz
//   - foo/bar/baz
genIgnorePatternPermutations receives as input a string possibly containing
one or more double-star separator patterns (/) and generates a list of
additional glob patterns that allow matching zero-or-more items at the
location of each double-star separator.

For example, given "foo/bar/baz" as input, this function returns:
- foo/bar/baz
- foo/bar/baz
- foo/bar/baz
- foo/bar/baz
// genIgnorePatternPermutations receives as input a string possibly containing // one or more double - star separator patterns ( / ** / ) and generates a list of // additional glob patterns that allow matching zero - or - more items at the // location of each double - star separator . // // For example given " foo / ** / bar / ** / baz " as input this function returns : // - foo / ** / bar / ** / baz // - foo / bar / ** / baz // - foo / ** / bar / baz // - foo / bar / baz
func genIgnorePatternPermutations(in string) []string {
	var (
		out       []string
		remaining = []string{in}
		addedPatternWithoutStars bool
	)
	for len(remaining) != 0 {
		next := remaining[0]
		remaining = remaining[1:]
		parts := strings.Split(next, "/**/")
		if len(parts) == 1 {
			if !addedPatternWithoutStars {
				out = append(out, next)
				addedPatternWithoutStars = true
			}
			continue
		}
		out = append(out, next)
		for i := 1; i < len(parts); i++ {
			remaining = append(
				remaining,
				strings.Join(parts[:i], "/**/")+"/"+strings.Join(parts[i:], "/**/"),
			)
		}
	}
	return out
}
func genIgnorePatternPermutations ( in string ) [ ] string { var ( out [ ] string remaining = [ ] string { in } addedPatternWithoutStars bool ) for len ( remaining ) != 0 { next := remaining [ 0 ] remaining = remaining [ 1 : ] parts := strings . Split ( next , " " ) if len ( parts ) == 1 { if ! addedPatternWithoutStars { out = append ( out , next ) addedPatternWithoutStars = true } continue } out = append ( out , next ) for i := 1 ; i < len ( parts ) ; i ++ { remaining = append ( remaining , strings . Join ( parts [ : i ] , " " ) + " " + strings . Join ( parts [ i : ] , " " ) , ) } } return out }
genIgnorePatternPermutations receives as input a string possibly containing
one or more double-star separator patterns (/) and generates a list of
additional glob patterns that allow matching zero-or-more items at the
location of each double-star separator.
genIgnorePatternPermutations receives as input a string possibly containing one or more double - star separator patterns ( / ) and generates a list of additional glob patterns that allow matching zero - or - more items at the location of each double - star separator .
// Split on the double-star separator; stop if no the pattern // does not contain any more double-star separators. // Push next to the the out list and append a list of patterns // to the remain list for the next run by sequentially // substituting each double star pattern with a slash. For // example if next is "a/**/b/**c" the generated patterns will // be: // - a/b/**/c // - a/**/b/c