From dc23592c7623e85b35dcdfb74e59e93cdb3b3976 Mon Sep 17 00:00:00 2001 From: yincong Date: Thu, 19 Sep 2024 20:09:15 +0800 Subject: [PATCH] template:fix line number is wrong in error info --- src/text/template/parse/lex.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/text/template/parse/lex.go b/src/text/template/parse/lex.go index 70fc86b63c..a00f48e658 100644 --- a/src/text/template/parse/lex.go +++ b/src/text/template/parse/lex.go @@ -352,6 +352,7 @@ func lexComment(l *lexer) stateFn { if !delim { return l.errorf("comment ends before closing delimiter") } + l.line += strings.Count(l.input[l.start:l.pos], "\n") i := l.thisItem(itemComment) if trimSpace { l.pos += trimMarkerLen