summaryrefslogtreecommitdiff
path: root/internal/repl/help.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-25 10:01:11 +0300
committerPaul Buetow <paul@buetow.org>2026-05-25 10:01:11 +0300
commit146a362a59ffd64f45e436eb97035d03085692b4 (patch)
tree16c0c468297db27d04cf55a75e64520c832c609e /internal/repl/help.go
parentf541136ae6cb3a3efa1bed3acafa3fee19b3a37e (diff)
style(repl): use map[string]struct{} for sets instead of map[string]bool
Idiomatic Go uses struct{} for zero-allocation sets. Two locations: - GetCompletionTopics: seen deduplication map - init(): seenCat category deduplication map
Diffstat (limited to 'internal/repl/help.go')
-rw-r--r--internal/repl/help.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/repl/help.go b/internal/repl/help.go
index 4c0691b..9796644 100644
--- a/internal/repl/help.go
+++ b/internal/repl/help.go
@@ -44,7 +44,7 @@ func GetAllTopics() []string {
// GetCompletionTopics returns all help topics suitable for tab completion.
// Includes operator names and aliases from all registered HelpTopic entries.
func GetCompletionTopics() []string {
- seen := make(map[string]bool)
+ seen := make(map[string]struct{})
var topics []string
// Add all operator names (skip "help" itself — no need to complete help help)
@@ -53,12 +53,12 @@ func GetCompletionTopics() []string {
continue
}
topics = append(topics, op)
- seen[op] = true
+ seen[op] = struct{}{}
// Add aliases
for _, a := range t.Aliases {
- if !seen[a] {
+ if _, ok := seen[a]; !ok {
topics = append(topics, a)
- seen[a] = true
+ seen[a] = struct{}{}
}
}
}