-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/gopls: index out of range (crash) #42927
Comments
Thanks for the report! Looks like an issue in a dependency, which will hopefully be resolved soon: sergi/go-diff#89. |
We're currently waiting to find out if there will be another release of the go-diff library. If not, we will update to the latest pseudoversion. |
Change https://golang.org/cl/275439 mentions this issue: |
Looks like there was a bug in the fix--filed sergi/go-diff#115. |
Change https://golang.org/cl/278775 mentions this issue: |
This CL handles the panic in the sergi/go-diff library which has not yet been resolved. We add an error return to the ComputeEdits function and return an error if there is a panic. I'm not sure if this is the best approach, but it does seem better than allowing the server to crash. A concern would be that the user wouldn't know why their code wasn't being formatted, but hopefully they might look through the logs and notice the error message. At least, other features would continue working. The best fix will definitely be the fix for the panic, but that is not yet available. Threading through the error return was not pretty, but I thought it was probably worth doing since it could be needed in other situations. Updates golang/go#42927 Change-Id: I7f0c05eb296ef9e93b4de8ef071301cdb9dce152 Reviewed-on: https://go-review.googlesource.com/c/tools/+/278775 Run-TryBot: Rebecca Stambler <rstambler@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Trust: Rebecca Stambler <rstambler@golang.org>
golang/tools@008e477 causes a compilation failure in $ GO111MODULE=on go get -u -v golang.org/x/tools/gopls@latest
...
go/pkg/mod/golang.org/x/tools/gopls@v0.6.1/internal/hooks/hooks.go:21:24: cannot use ComputeEdits (type func(span.URI, string, string) []diff.TextEdit) as type diff.ComputeEdits in assignment
... So I'm assuming that I'm not supposed to use @latest. I'm surprised though, it seems to all be in the same repo... |
The issue is the |
This CL handles the panic in the sergi/go-diff library which has not yet been resolved. We add an error return to the ComputeEdits function and return an error if there is a panic. I'm not sure if this is the best approach, but it does seem better than allowing the server to crash. A concern would be that the user wouldn't know why their code wasn't being formatted, but hopefully they might look through the logs and notice the error message. At least, other features would continue working. The best fix will definitely be the fix for the panic, but that is not yet available. Threading through the error return was not pretty, but I thought it was probably worth doing since it could be needed in other situations. Updates golang/go#42927 Change-Id: I7f0c05eb296ef9e93b4de8ef071301cdb9dce152 Reviewed-on: https://go-review.googlesource.com/c/tools/+/278775 Run-TryBot: Rebecca Stambler <rstambler@golang.org> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Trust: Rebecca Stambler <rstambler@golang.org>
Apologies for the noise caused by not fully grokking the installation instructions and just copying from my approach for non-module enabled packages. Thanks a lot for the help, much appreciated. |
gopls version: v0.5.4
gopls flags:
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.
NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
<OPTIONAL: ATTACH LOGS HERE>
The text was updated successfully, but these errors were encountered: