-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: runtime error: index out of range [495] #61670
Comments
@sylr this will be hard to track down without a repro. If this is closed-source, could you please do the following to get us a real stack trace?
Running gopls with the resulting binary will crash during import, and reveal the real problem. |
|
Thank you very much @sylr. Can you please try patching the following CL, and check if it fixes the bug?
After doing that, if it doesn't fix the problem could you try nuking your gopls file cache? (it is likely under |
Change https://go.dev/cl/514355 mentions this issue: |
@sylr could I ask you to do one more thing? The codepath that was buggy was supposed to only be hit in "impossible" scenarios. The buggy logic was related to the fallback behavior. If you could do the following, it would help us find the underlying bug in our export algorithm: In
(and then add the missing import of Then your gopls should be broken again, but the error message will tell us which struct field could not be found by the objectpath algorithm. Without sharing the code, if you could describe to us the nature of that field (where is it defined, is it embedded, is it part of a type declaration, etc), that would be very helpful. |
Actually, I have found one such case, when promoting an instantiated field from another package:
I'd be curious if the problematic object in your repo follows a similar pattern. |
Can reproduce this sort of problem with exported embedded fields for a type definition. Variants of this pattern:
I've also seen the "index out of range" issue in a real codebase, this example is what I managed to reduce it to. |
gopls version
go env
What did you do?
Upgraded from something pre v0.13.0 to v0.13.0 and got errors.
What did you expect to see?
No errors.
What did you see instead?
Editor and settings
VSCode / Go
Logs
The text was updated successfully, but these errors were encountered: