From 72cc93d22597558578c216da0046041e6cdcb9b3 Mon Sep 17 00:00:00 2001 From: Jeanette Tan Date: Wed, 25 Oct 2023 18:10:42 +0800 Subject: [PATCH] Hide position info for warnings when position is unknown (empty query string passed in) Signed-off-by: Jeanette Tan --- util/annotations/annotations.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/annotations/annotations.go b/util/annotations/annotations.go index 9cfbb121f..52cfb114b 100644 --- a/util/annotations/annotations.go +++ b/util/annotations/annotations.go @@ -116,6 +116,9 @@ type annoErr struct { } func (e annoErr) Error() string { + if e.Query == "" { + return e.Err.Error() + } return fmt.Sprintf("%s (%s)", e.Err, e.PositionRange.StartPosInput(e.Query, 0)) }