code: func newIgnoreChecker(ignoredFiles []string) func(path string) (shouldIgnore bool) {
  	var fns []func(string) bool
  
  	// copy of ignoredFiles for us to mutate
  	ignFiles := append([]string(nil), ignoredFiles...)
  	for k, v := range ignFiles {
  		if strings.HasPrefix(v, filepath.FromSlash("~/")) {
  			ignFiles[k] = filepath.Join(osutilHomeDir(), v[2:])
  		}
  	}
  	// We cache the ignoredFiles patterns in 3 categories (not necessarily exclusive):
  	// 1) shell patterns
  	// 3) absolute paths
  	// 4) paths components
  	for _, pattern := range ignFiles {
  		pattern := pattern
  		_, err := filepath.Match(pattern, "whatever")
  		if err == nil {
  			fns = append(fns, func(v string) bool { return isShellPatternMatch(pattern, v) })
  		}
  	}
  	for _, pattern := range ignFiles {
  		pattern := pattern
  		if filepath.IsAbs(pattern) {
  			fns = append(fns, func(v string) bool { return hasDirPrefix(filepath.Clean(pattern), v) })
  		} else {
  			fns = append(fns, func(v string) bool { return hasComponent(filepath.Clean(pattern), v) })
  		}
  	}
  
  	return func(path string) bool {
  		for _, fn := range fns {
  			if fn(path) {
  				return true
  			}
  		}
  		return false
  	}
  }
docs: // newIgnoreChecker uses ignoredFiles to build and return a func that returns whether the file path argument should be ignored. See IsIgnoredFile for the ignore rules.