From 3ef81134a1931722fea640d2ee75e6d71fa86ac9 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Wed, 16 Mar 2022 08:00:50 -0700 Subject: [PATCH] fix(cli): fixing ignoring lines starting with '#' in 'policy edit' (#1830) Fixes #1821 --- internal/editor/editor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/editor/editor.go b/internal/editor/editor.go index d173d0a53..2bc3e2591 100644 --- a/internal/editor/editor.go +++ b/internal/editor/editor.go @@ -75,7 +75,9 @@ func readAndStripComments(fname string) (string, error) { s := bufio.NewScanner(f) for s.Scan() { l := s.Text() - l = strings.TrimSpace(strings.Split(l, "#")[0]) + if strings.HasPrefix(strings.TrimSpace(l), "#") { + continue + } if l != "" { result = append(result, l)