From 9eb207f3cf28e8dd72217204b5e1d8ef8702bcd0 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Mon, 18 Aug 2025 14:23:55 -0300 Subject: [PATCH] refactor: migrate bool to empty struct for lower memory usage --- internal/shell/shell.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/shell/shell.go b/internal/shell/shell.go index 0d2df7b11abc6c8261a77f46b7eb4c93e9c63e70..58e63fc245bfda708c87f9b39895705d3ee5d344 100644 --- a/internal/shell/shell.go +++ b/internal/shell/shell.go @@ -157,16 +157,17 @@ func (s *Shell) SetBlockFuncs(blockFuncs []BlockFunc) { // CommandsBlocker creates a BlockFunc that blocks exact command matches func CommandsBlocker(bannedCommands []string) BlockFunc { - bannedSet := make(map[string]bool) + bannedSet := make(map[string]struct{}) for _, cmd := range bannedCommands { - bannedSet[cmd] = true + bannedSet[cmd] = struct{}{} } return func(args []string) bool { if len(args) == 0 { return false } - return bannedSet[args[0]] + _, ok := bannedSet[args[0]] + return ok } }