From: Mateusz Poliwczak Date: Fri, 23 Jan 2026 09:19:18 +0000 (+0100) Subject: go/parser: use (*Scanner).End in error testing X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=15882523a18cf7653c17e7c91aeaa1174a23702b;p=gostls13.git go/parser: use (*Scanner).End in error testing Updates #74958 Change-Id: I43dcbff6ec828bddf157b2e6ec80df526a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/738700 Reviewed-by: Alan Donovan LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov --- diff --git a/src/go/parser/error_test.go b/src/go/parser/error_test.go index 252325659c..aa4fd65962 100644 --- a/src/go/parser/error_test.go +++ b/src/go/parser/error_test.go @@ -81,6 +81,8 @@ func expectedErrors(fset *token.FileSet, filename string, src []byte) map[token. for { pos, tok, lit := s.Scan() + end := s.End() + switch tok { case token.EOF: return errors @@ -104,13 +106,7 @@ func expectedErrors(fset *token.FileSet, filename string, src []byte) map[token. fallthrough default: prev = pos - var l int // token length - if tok.IsLiteral() { - l = len(lit) - } else { - l = len(tok.String()) - } - here = prev + token.Pos(l) + here = end } } }