diff --git a/_repoUtils/main.go b/_repoUtils/main.go index a92f0be..163cc55 100644 --- a/_repoUtils/main.go +++ b/_repoUtils/main.go @@ -56,11 +56,13 @@ func prettyPrintResults(data *map[string]int) { func generateFile(dirStats *map[string]int) { type Entry struct { - Topic string - Count int + Topic string + Count int + Percentage int } - entries := make([]Entry, 0, len(*dirStats)) + total := len(*dirStats) + entries := make([]Entry, 0, total) for k, v := range *dirStats { topic := strings.ReplaceAll(strings.Title(k), "-", " ") @@ -68,6 +70,7 @@ func generateFile(dirStats *map[string]int) { entries = append(entries, entry) } sort.SliceStable(entries, func(i, j int) bool { + entries[i].Percentage = 5 return entries[i].Count > entries[j].Count })