-
Notifications
You must be signed in to change notification settings - Fork 18k
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: using overlay in GOPACKAGESDRIVER fails or panics #33727
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here. |
I agree that we should probably handle nil pointers in go/analysis a bit better, as these do seem to happen fairly often. However, I'm not sure on how to help with the overlay issue - is there a way we can reproduce this to help you investigate? I'm not surprised that |
Change https://golang.org/cl/190908 mentions this issue: |
Updates golang/go#33727, golang/go#33689 Change-Id: Ie32ac4efc9fe0d7b08fcff3feb44b28d83df942d Reviewed-on: https://go-review.googlesource.com/c/tools/+/190908 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
I've added an example of this as kylelemons/gopls33727 -- though along the way, it looks like the panic that I'm getting might not actually relate to the overlay. If you comment out the overlay environment variable and replace MaxInt with something that exists like Max, I still see the same panic. EDIT: If I patch
|
I'm sorry for the delay on replying to this; it must have slipped my notice. @kylelemons: Is this still an issue for you? |
It's not a problem for me at the moment in a sense because I haven't had a chance to hack on the project that was making use of this (making a gopackagesdriver for working within tinygo) recently. |
We do now have a |
Closing this as, based on #33727 (comment), the |
I can't seem to figure out how to prepare the results from my GOPACKAGESDRIVER for gopls to correctly use them. I am using overlay to simultaneously inject my own new packages and to zero out (i.e. replace with
package pkgname
) any files that are not in my overlay to try to get autocompletion working for TinyGo-based Go programs (which have their own "machine" "runtime" etc packages). In the course of this, I accidentally managed to get gopls to crash. While the input is almost certainly incorrect in some way, it seems like gopls would prefer not tp allow malformed input (from either Go source or GOPACKAGESDRIVERs) to cause it to panic.What did you do?
I am working on trying to get a go/packages driver working for TinyGo. My package driver performs overlays before calling out to packages.Load. If I do this, then I see errors about not being able to open files under $GOROOT that aren't actually there, they're in an overlay. So, I decided to translate the GoFiles, CompiledGoFiles, etc back to the original files on their way back to gopls. This only made things even more interesting :)
What did you expect to see?
Gopls should parse the remapped files (maybe), or at least report an error message if some information is not available.
What did you see instead?
gopls crashes with a stack trace:
This corresponds to the
if
statement below in analysis.go:I checked the results that are getting sent back, and they do set TypesSizes:
{ "WordSize": 4, "MaxAlign": 4 }
If I forcibly return from that analysis, I get a different failure further down the line:
Build info
Go info
The text was updated successfully, but these errors were encountered: