Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/tools/gopls: imports.Resolver is *imports.gopathResolver, not *imports.ModuleResolver #37108
What did you do?
After vscode (1.41.1-1576681836 @ Ubuntu 16.04) upgraded gopls from v0.2.2 to v0.3.1, it crashes on start.
I could not isolate it to specific code. Gopls only crashes inside vscode. My project (some 66 .go files, using go-yara C interface) does not produce a crash when I run
I have downgraded to v0.2.2 for now.
What did you expect to see?
What did you see instead?
vscode reports gopls output:
Very strange. I could fix the crash very easily, but you'd be left with broken autocomplete. The problem is that the goimports code used for autocomplete thinks you're in GOPATH mode. I'm not sure why.
A couple questions:
Can you show us those too?
Thanks for quick followup!
GOPATH is set in my .bashrc, remnant from non-module projects. When I unset GOPATH before launching
Still very strange.
There should be more than one call to
Now that I'm looking at it, swallowing the error is a bad idea. I'll look at fixing that next week. If you'd like, figuring out what's going wrong with it will get this resolved more quickly.
I see no non-json
Am happy to dig further. Any ideas how I should replicate this panic outside of vscode?
Got it. I replaced gopls with a wrapper to debug:
Turns out, gopls first runs
It fails because it is not correctly quoted. For reference, this works fine:
In my vscode settings, I have:
I don't know why it worked with v0.2.2, perhaps previously GOFLAGS wasn't passed to
My problem is now solved, because I have eliminated the GOFLAGS entirely from my vscode setup.
Thanks @heschik for your help in resolving this!
This change adds a buildFlags variable to the processEnv struct rather than appending them to the GOFLAGS by using a space separator. Fixes golang/go#37108 Change-Id: I4331066c30fa51f0133504d723132527b00ce74a Reviewed-on: https://go-review.googlesource.com/c/tools/+/218857 Reviewed-by: Heschi Kreinick <firstname.lastname@example.org> Run-TryBot: Heschi Kreinick <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> (cherry picked from commit 3868802) Reviewed-on: https://go-review.googlesource.com/c/tools/+/219124