generator/app: add means for sorted and de-duped OWNERS_ALIASES

- Add LeadershipGroup#Owners() which returns a sorted and de-duped
list of owners ([]Person) for this LeadershipGroup by combining
Chairs and TechnicalLeads
- The function is used in generator/aliases.tmpl
- Update OWNERS_ALIASES with the new results
This commit is contained in:
Lubomir I. Ivanov 2020-01-23 04:44:02 +02:00
parent ba5dd2e8c2
commit 0d52e7b449
3 changed files with 35 additions and 16 deletions

View File

@ -2,7 +2,6 @@ aliases:
sig-api-machinery-leads:
- deads2k
- fedebongio
- deads2k
- lavalamp
sig-apps-leads:
- janetkuo
@ -14,31 +13,29 @@ aliases:
- dims
- johnbelamaric
sig-auth-leads:
- enj
- mikedanese
- tallclair
- deads2k
- enj
- liggitt
- mikedanese
- tallclair
sig-autoscaling-leads:
- mwielgus
sig-cli-leads:
- seans3
- soltysh
- pwittrock
- seans3
- soltysh
sig-cloud-provider-leads:
- andrewsykim
- cheftako
sig-cluster-lifecycle-leads:
- fabriziopandini
- justinsb
- neolit123
- timothysc
- fabriziopandini
sig-contributor-experience-leads:
- Phillels
- mrbobbytables
- cblecker
- mrbobbytables
- nikhita
sig-docs-leads:
- Bradamant3
@ -94,9 +91,9 @@ aliases:
- vllry
sig-windows-leads:
- PatrickLang
- michmike
- benmoss
- ddebroy
- michmike
wg-apply-leads:
- lavalamp
wg-component-standard-leads:
@ -146,8 +143,10 @@ aliases:
- foxish
- liyinan926
ug-vmware-users-leads:
- brysonshepherd
- cantbewong
- mylesagray
- phenixblue
committee-code-of-conduct:
- AevaOnline
- Bradamant3

View File

@ -1,28 +1,25 @@
aliases:
{{- range .Sigs}}
{{.Dir}}-leads:
{{- range .Leadership.Chairs}}
- {{.GitHub}}
{{- end}}
{{- range .Leadership.TechnicalLeads}}
{{- range .Leadership.Owners}}
- {{.GitHub}}
{{- end}}
{{- end}}
{{- range .WorkingGroups}}
{{.Dir}}-leads:
{{- range .Leadership.Chairs}}
{{- range .Leadership.Owners}}
- {{.GitHub}}
{{- end}}
{{- end}}
{{- range .UserGroups}}
{{.Dir}}-leads:
{{- range .Leadership.Chairs}}
{{- range .Leadership.Owners}}
- {{.GitHub}}
{{- end}}
{{- end}}
{{- range .Committees}}
{{.Dir}}:
{{- range .Leadership.Chairs}}
{{- range .Leadership.Owners}}
- {{.GitHub}}
{{- end}}
{{- end}}

View File

@ -122,6 +122,29 @@ func (g *LeadershipGroup) PrefixToPersonMap() map[string][]Person {
}
}
// Owners returns a sorted and de-duped list of owners for a LeadershipGroup
func (g *LeadershipGroup) Owners() []Person {
o := append(g.Chairs, g.TechnicalLeads...)
// Sort
sort.Slice(o, func(i, j int) bool {
return o[i].GitHub < o[j].GitHub
})
// De-dupe
seen := make(map[string]struct{}, len(o))
i := 0
for _, p := range o {
if _, ok := seen[p.GitHub]; ok {
continue
}
seen[p.GitHub] = struct{}{}
o[i] = p
i++
}
return o[:i]
}
// Group represents either a Special Interest Group (SIG) or a Working Group (WG)
type Group struct {
Dir string