Skip to content

Commit

Permalink
update: sort projects of approvers
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
  • Loading branch information
leodido committed Dec 14, 2020
1 parent 11edd38 commit 3a08e55
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion approvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"reflect"
"sort"

"github.com/sirupsen/logrus"
"k8s.io/test-infra/prow/repoowners"
Expand Down Expand Up @@ -92,7 +93,7 @@ func getApprovers(ownersClient *repoowners.Client, org, repo string, dedupe bool
// Merge two approvers maps.
//
// This function never replaces any key that already exists in the left map (lx).
func mergeApprovers(lx, rx map[string][]string) map[string][]string {
func mergeApprovers(lx, rx map[string][]string, sorting bool) map[string][]string {
for key, rv := range rx {
if lv, present := lx[key]; present {
// Then we don't want to replace it, append
Expand All @@ -101,6 +102,9 @@ func mergeApprovers(lx, rx map[string][]string) map[string][]string {
// Key not in the left map so we can just shove it in
lx[key] = rv
}
if sorting {
sort.Strings(lx[key])
}
}
return lx
}

0 comments on commit 3a08e55

Please sign in to comment.