INNER CODE UNIT · Go
outputJSON
xm1k3/cent · cmd/summary.go:256
func outputJSON(summaryPath string, limit int) {
stats := loadSummary(summaryPath)
if limit > 0 {
limitedTags := make(map[string]int)
type tagCount struct {
tag string
count int
}
var tagCounts []tagCount
for tag, count := range stats.Tags {
tagCounts = append(tagCounts, tagCount{tag, count})
}
sort.Slice(tagCounts, func(i, j int) bool {
return tagCounts[i].count > tagCounts[j].count
})
for i := 0; i < len(tagCounts) && i < limit; i++ {