code: func unifySubs(dirs []string, exists func(dir string) bool) []string {
  	if len(dirs) == 0 {
  		return nil
  	}
  	sort.Strings(dirs)
  	if dirs[0] == "" || dirs[0] == "." || dirs[0] == string(fs.PathSeparator) {
  		return nil
  	}
  	prev := "./" // Anything that can't be parent of a clean path
  	for i := 0; i < len(dirs); {
  		dir, err := fs.Canonicalize(dirs[i])
  		if err != nil {
  			l.Debugf("Skipping %v for scan: %s", dirs[i], err)
  			dirs = append(dirs[:i], dirs[i+1:]...)
  			continue
  		}
  		if dir == prev || fs.IsParent(dir, prev) {
  			dirs = append(dirs[:i], dirs[i+1:]...)
  			continue
  		}
  		parent := filepath.Dir(dir)
  		for parent != "." && parent != string(fs.PathSeparator) && !exists(parent) {
  			dir = parent
  			parent = filepath.Dir(dir)
  		}
  		dirs[i] = dir
  		prev = dir
  		i++
  	}
  	return dirs
  }
docs: // The exists function is expected to return true for all known paths
  // (excluding "" and ".")