From cd57dbc770dc119079268a8baeeed41a862726a5 Mon Sep 17 00:00:00 2001 From: eleksir Date: Tue, 31 Mar 2026 01:18:33 +0300 Subject: [PATCH] More efficient look for leading "{" symbold in stdin.go --- internal/lib/stdin.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/internal/lib/stdin.go b/internal/lib/stdin.go index e7605ac..681a3ab 100644 --- a/internal/lib/stdin.go +++ b/internal/lib/stdin.go @@ -51,17 +51,11 @@ func (c *MyConfig) ParseStdin() { continue } - for i := 0; i < len(buf); i++ { - if strings.HasPrefix(buf, "{") { - break - } - - buf = buf[1:] - } - - if len(buf) == 0 { - log.Print("String from stdin has zero length, skipping") + buf = strings.TrimLeftFunc(buf, func(r rune) bool { + return r != '{' + }) + if !strings.HasPrefix(buf, "{") { continue }