Skip to content

Commit

Permalink
feat: sort repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
juev committed Dec 31, 2023
1 parent 79e6716 commit 34ab0ab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions github.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import (
"cmp"
"context"
"fmt"
"log"
"os"
"slices"

"github.com/google/go-github/v57/github"
"github.com/gregjones/httpcache"
Expand Down Expand Up @@ -101,6 +103,16 @@ func (g *GitHub) GetRepositories(ctx context.Context) (langRepoMap map[string][]
return nil, repositories
}

slices.SortFunc(repositories, func(a, b Repository) int {
return cmp.Compare(a.FullName, b.FullName)
})

for _, repositories := range langRepoMap {
slices.SortFunc(repositories, func(a, b Repository) int {
return cmp.Compare(a.FullName, b.FullName)
})
}

return langRepoMap, repositories
}

Expand Down

0 comments on commit 34ab0ab

Please sign in to comment.