go/internal/span
Robert Findley 6ec939a616 internal/span: fix incorrect bounds check in ToOffset
token.File.LineStart panics if line < 1, but we were checking line < 0.
Surprising that this was not hit more often: it looks like we
pre-validate input except for parsed positions coming from the Go
command. It is possible that an older version of the Go command returned
invalid positions.

Also report a bug for one error condition in ToOffset: the position
returned by LineStart should always be valid.

Fixes golang/go#54006

Change-Id: I5965af9c62976b3e00b023512df334a8de943a3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/419109
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
2022-07-25 14:31:12 +00:00
..
parse.go internal/lsp/cache: parse filenames from go list errors correctly 2021-03-02 01:39:30 +00:00
span.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
span_test.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
token.go internal/span: fix incorrect bounds check in ToOffset 2022-07-25 14:31:12 +00:00
token_test.go internal/span: eliminate TokenConverter 2022-06-01 19:19:15 +00:00
uri.go internal/span: optimise URI.Filename to avoid allocation 2022-06-22 02:37:34 +00:00
uri_test.go
uri_windows_test.go
utf16.go internal/lsp/mod: fix broken assumptions about file base 2022-06-01 22:04:06 +00:00
utf16_test.go