Move to Go 1.27, and fix initials for non-ASCII names

Initials() capped the loop with len(out) == 2, which counts bytes: a name
starting with Ä, Ö or Å filled the budget on its own and returned a single
letter. Count the initials taken instead.

go fix also wanted a strings.Builder here, but that allocates a string per
iteration to measure a two-character result. Took its SplitSeq suggestion
in lyrics.go, which drops an intermediate slice.
This commit is contained in:
Esa Kataja
2026-09-05 12:46:08 +03:00
parent 992caa4eb1
commit 10ec9d1d6e
5 changed files with 20 additions and 5 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ func parseLRC(s string) []lyricLine {
return nil
}
var out []lyricLine
for _, raw := range strings.Split(s, "\n") {
for raw := range strings.SplitSeq(s, "\n") {
stamps := lrcOne.FindAllStringSubmatch(raw, -1)
if len(stamps) == 0 {
continue