From 146a362a59ffd64f45e436eb97035d03085692b4 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 25 May 2026 10:01:11 +0300 Subject: 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 --- internal/repl/help.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/repl/help.go') 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{}{} } } } -- cgit v1.2.3