-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/imports: panic in (*moduleResolver).scan #30292
Comments
/cc @heschik @ianthehat |
@stamblerre: I think this means that the imports code is running with |
@pwaller: do you remember what directory you opened VSCode with? I'm having trouble reproducing this exact case, though the malformed defer statement does seem to cause the goimports logic to fail (though I only see an error message, not a panic). |
Indeed, I cannot reproduce if I run everything in the same directory. If I run gopls from, for example, my home directory, then the crash is reproducible. I'm opening vscode with I wasn't expecting gopls to be sensitive to where it was invoked. Is it meant to be? |
VSCode sets a "rootURI" value which we then use as the "Dir" in the packages.Config - the context for this is https://golang.org/cl/153863. |
Also, I was able to reproduce your issue at the commit you mentioned, but at tip, this situation causes a different nil pointer in diagnostics. I think ultimately the underlying issue is deciding what to do when the rootURI sent by VSCode is not valid for the file in question. /cc @ianthehat |
Duplicate of #29174 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I'm on x/tools commit 44bcb96. I tried reproducing on the master branch but that crashes for a different reason. I figure this stack trace will be useful anyway.
What did you do?
Using
gopls
withforward
(note: this workflow is out of date but the new workflow doesn't work for me for unrelated reasons) under vscode.defer foobar.Baz.
at the top of main.What did you expect to see?
Nothing, because
foobar.Baz.
isn't valid (I made it up).What did you see instead?
gopls reliably crashes every time.
/cc @stamblerre
The text was updated successfully, but these errors were encountered: