-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: OOB index panic after parsing go list error from file with //line directives #67360
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
Comments
Thanks for the bug report. I think the problem is that gopls is parsing an error from go list that doesn't have a line or column, which causes it to use zero for both fields, when the correct value is one. Fix pending. Which package was this file part of? The error message that triggered the fault is a property of the complete package, not just this file. |
Answer: cmd/cover. Never mind. |
Thanks for looking into the problem. Admittedly editing the output of cmd/cover is a weird thing to do, but maybe someone else out there might also run into it. |
Can you tell me what exact sequence of steps you used to get the crash? It would be nice to add a test to my CL, but the file by itself doesn't cause a problem, nor do various cmd/cover workflows I've tried. I suspect it's something to do with the file in relation to the other files in your particular workflow, since that's what would cause 'go list' to report an error. |
I can see the problem when I copy the file into its own dir and run emacs on it, e.g.
Does this work for you? |
Yep! Thanks. (I swear I already tried that, but I think I must have disabled "auto manage" mode in eglot earlier in the day while debugging a different problem and forgotten to reenable it.) |
Minimal repro: //line html.go:1
package main
import _ "cmd/internal/browser" causes go list error:
Seems like the //line directive is confusing the bounds check. |
Change https://go.dev/cl/585555 mentions this issue: |
Working with x/tools at commit 487737a1960720c6595131017ff98eef1586fa04, when I build gopls and use it in an emacs session on this file https://go.dev/play/p/_EKzBXvi29C , I get a crash . Full log attached as text file, but the interesting portion of the trace is here:
I am guessing that what's at issue here is the tool-generated counter increments.
Thanks.
log.txt
The text was updated successfully, but these errors were encountered: