1
0
mirror of https://github.com/golang/go synced 2024-11-15 00:40:31 -07:00

template:fix line number is wrong in error info

This commit is contained in:
yincong 2024-09-19 20:09:15 +08:00
parent 165bf241f2
commit dc23592c76
No known key found for this signature in database
GPG Key ID: D37F4B83EDFE5B0F

View File

@ -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