code: func TrackedSet(patterns []string) func(string) (bool, error) {
  	if len(patterns) == 0 {
  		return func(string) (bool, error) { return false, nil }
  	}
  
  	var pos, neg []string
  	for _, pat := range patterns {
  		if strings.HasPrefix(pat, "!") {
  			neg = append(neg, pat[1:])
  		} else {
  			pos = append(pos, pat)
  		}
  	}
  
  	if len(pos) == 0 {
  		pos = []string{"**/*"}
  	}
  
  	return func(p string) (bool, error) {
  		if isPos, err := matchesAny(p, pos); !isPos || err != nil {
  			return false, err
  		}
  		if isNeg, err := matchesAny(p, neg); isNeg || err != nil {
  			return false, err
  		}
  		return true, nil
  	}
  }
docs: // TrackedSet returns a predicate that classifies whether a slash-separated path
  // belongs to a tracked set or not.
  //
  // Each entry in `patterns` is either `<glob pattern>` (a "positive" glob) or
  // `!<glob pattern>` (a "negative" glob). A path is considered tracked if its
  // base name matches any of the positive globs and none of the negative globs.
  // If `patterns` is empty, no paths are considered tracked. If all patterns
  // are negative, single `**/*` positive pattern is implied as well.
  //
  // The predicate returns an error if some pattern is malformed.