prow/repoowners/repoowners.go
func findOwnersForFile(log *logrus.Entry, path string, ownerMap map[string]map[*regexp.Regexp]sets.String) string {
	d := path

	for ; d != baseDirConvention; d = canonicalize(filepath.Dir(d)) {
		relative, err := filepath.Rel(d, path)
		if err != nil {
			log.WithError(err).WithField("path", path).Errorf("Unable to find relative path between %q and path.", d)
			return ""
		}
		for re, n := range ownerMap[d] {
			if re != nil && !re.MatchString(relative) {
				continue
			}
			if len(n) != 0 {
				return d
			}
		}
	}
	return ""
}
func findOwnersForFile(log *logrus.Entry, path string, ownerMap map[string]map[*regexp.Regexp]sets.String) string {
	d := path

	for ; d != baseDirConvention; d = canonicalize(filepath.Dir(d)) {
		relative, err := filepath.Rel(d, path)
		if err != nil {
			log.WithError(err).WithField("path", path).Errorf("Unable to find relative path between %q and path.", d)
			return ""
		}
		for re, n := range ownerMap[d] {
			if re != nil && !re.MatchString(relative) {
				continue
			}
			if len(n) != 0 {
				return d
			}
		}
	}
	return ""
}
func findOwnersForFile ( log * logrus . Entry , path string , ownerMap map [ string ] map [ * regexp . Regexp ] sets . String ) string { d := path for ; d != baseDirConvention ; d = canonicalize ( filepath . Dir ( d ) ) { relative , err := filepath . Rel ( d , path ) if err != nil { log . WithError ( err ) . WithField ( " " , path ) . Errorf ( " " , d ) return " " } for re , n := range ownerMap [ d ] { if re != nil && ! re . MatchString ( relative ) { continue } if len ( n ) != 0 { return d } } } return " " }
// findOwnersForFile returns the OWNERS file path furthest down the tree for a specified file
// using ownerMap to check for entries
findOwnersForFile returns the OWNERS file path furthest down the tree for a specified file using ownerMap to check for entries