func (ix *RuleIndex) FindRulesByImport(imp ImportSpec, lang string) []FindResult {
	matches := ix.importMap[imp]
	results := make([]FindResult, 0, len(matches))
	for _, m := range matches {
		if ix.mrslv(m.rule, "").Name() != lang {
			continue
		}
		results = append(results, FindResult{
			Label:  m.label,
			Embeds: m.embeds,
		})
	}
	return results
}
func (ix *RuleIndex) FindRulesByImport(imp ImportSpec, lang string) []FindResult {
	matches := ix.importMap[imp]
	results := make([]FindResult, 0, len(matches))
	for _, m := range matches {
		if ix.mrslv(m.rule, "").Name() != lang {
			continue
		}
		results = append(results, FindResult{
			Label:  m.label,
			Embeds: m.embeds,
		})
	}
	return results
}
func ( ix * RuleIndex ) FindRulesByImport ( imp ImportSpec , lang string ) [ ] FindResult { matches := ix . importMap [ imp ] results := make ( [ ] FindResult , 0 , len ( matches ) ) for _ , m := range matches { if ix . mrslv ( m . rule , " " ) . Name ( ) != lang { continue } results = append ( results , FindResult { Label : m . label , Embeds : m . embeds , } ) } return results }
// FindRulesByImport attempts to resolve an import string to a rule record.
// imp is the import to resolve (which includes the target language). lang is
// the language of the rule with the dependency (for example, in
// go_proto_library, imp will have ProtoLang and lang will be GoLang).
// from is the rule which is doing the dependency. This is used to check
// vendoring visibility and to check for self-imports.
//
// FindRulesByImport returns a list of rules, since any number of rules may
// provide the same import. Callers may need to resolve ambiguities using
// language-specific heuristics.
FindRulesByImport attempts to resolve an import string to a rule record . imp is the import to resolve ( which includes the target language ) . lang is the language of the rule with the dependency ( for example in go_proto_library imp will have ProtoLang and lang will be GoLang ) . from is the rule which is doing the dependency . This is used to check vendoring visibility and to check for self - imports . FindRulesByImport returns a list of rules since any number of rules may provide the same import . Callers may need to resolve ambiguities using language - specific heuristics .