prow/spyglass/spyglass.go
func (s *Spyglass) Lenses(matchCache map[string][]string) []lenses.Lens {
	ls := []lenses.Lens{}
	for lensName, matches := range matchCache {
		if len(matches) == 0 {
			continue
		}
		lens, err := lenses.GetLens(lensName)
		if err != nil {
			logrus.WithField("lensName", lens).WithError(err).Error("Could not find artifact lens")
		} else {
			ls = append(ls, lens)
		}
	}
	// Make sure lenses are rendered in order by ascending priority
	sort.Slice(ls, func(i, j int) bool {
		iconf := ls[i].Config()
		jconf := ls[j].Config()
		iname := iconf.Name
		jname := jconf.Name
		pi := iconf.Priority
		pj := jconf.Priority
		if pi == pj {
			return iname < jname
		}
		return pi < pj
	})
	return ls
}
func (s *Spyglass) Lenses(matchCache map[string][]string) []lenses.Lens {
	ls := []lenses.Lens{}
	for lensName, matches := range matchCache {
		if len(matches) == 0 {
			continue
		}
		lens, err := lenses.GetLens(lensName)
		if err != nil {
			logrus.WithField("lensName", lens).WithError(err).Error("Could not find artifact lens")
		} else {
			ls = append(ls, lens)
		}
	}
	// Make sure lenses are rendered in order by ascending priority
	sort.Slice(ls, func(i, j int) bool {
		iconf := ls[i].Config()
		jconf := ls[j].Config()
		iname := iconf.Name
		jname := jconf.Name
		pi := iconf.Priority
		pj := jconf.Priority
		if pi == pj {
			return iname < jname
		}
		return pi < pj
	})
	return ls
}
func ( s * Spyglass ) Lenses ( matchCache map [ string ] [ ] string ) [ ] lenses . Lens { ls := [ ] lenses . Lens { } for lensName , matches := range matchCache { if len ( matches ) == 0 { continue } lens , err := lenses . GetLens ( lensName ) if err != nil { logrus . WithField ( " " , lens ) . WithError ( err ) . Error ( " " ) } else { ls = append ( ls , lens ) } } // Make sure lenses are rendered in order by ascending priority sort . Slice ( ls , func ( i , j int ) bool { iconf := ls [ i ] . Config ( ) jconf := ls [ j ] . Config ( ) iname := iconf . Name jname := jconf . Name pi := iconf . Priority pj := jconf . Priority if pi == pj { return iname < jname } return pi < pj } ) return ls }
// Lenses gets all views of all artifact files matching each regexp with a registered lens
Lenses gets all views of all artifact files matching each regexp with a registered lens