commit f2011e8
delthas
·
2026-03-11 13:03:58 +0000 UTC
parent cc46b93
Replace maps.Keys/slices.Sorted with Go 1.21-compatible code These functions require Go 1.23 but go.mod declares Go 1.21.
1 files changed,
+6,
-3
+6,
-3
1@@ -2,10 +2,8 @@ package senpai
2
3 import (
4 "fmt"
5- "maps"
6 "os"
7 "path/filepath"
8- "slices"
9 "sort"
10 "strings"
11
12@@ -276,7 +274,12 @@ func (app *App) completionsCommands(cs []ui.Completion, cursorIdx int, text []ru
13 }
14
15 uText := strings.ToUpper(string(text[1:cursorIdx]))
16- for _, name := range slices.Sorted(maps.Keys(commands)) {
17+ names := make([]string, 0, len(commands))
18+ for name := range commands {
19+ names = append(names, name)
20+ }
21+ sort.Strings(names)
22+ for _, name := range names {
23 if strings.HasPrefix(name, uText) {
24 c := make([]rune, len(text)+len(name)-len(uText))
25 copy(c[:1], []rune("/"))