cmd/score/score.go: case-insensitive sort

This commit is contained in:
Peter Kleiweg
2026-03-25 17:46:31 +01:00
parent 2390752ba4
commit 9686b8b846

View File

@@ -13,9 +13,10 @@ import (
)
type Item struct {
text string
score int
isnew bool
text string
lctext string
score int
isnew bool
}
var (
@@ -50,9 +51,10 @@ func main() {
x(err)
n1, ok := count[aa[1]]
items = append(items, Item{
text: aa[1],
score: n - n1,
isnew: !ok,
text: aa[1],
lctext: strings.ToLower(aa[1]),
score: n - n1,
isnew: !ok,
})
}
x(scanner.Err())
@@ -70,7 +72,7 @@ func main() {
if items[i].score != items[j].score {
return items[i].score > items[j].score
}
return items[i].text < items[j].text
return items[i].lctext < items[j].lctext
})
for _, item := range items {