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: "no dep handle" on import #37786
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
Could this be related to some kind of state written under I was curious if anything under my current I expected to get the original error again when I then reverted back to setting I'm not sure how to explain that. And I have to emphasize that while trying to figure out the original error, I reloaded VSCode and |
What directory are you opening? I'm not able to reproduce the issue when opening VS Code at the directory containing the In general, |
I think that's the cause: Initially I opened the parent folder. I have a "scratch" folder I keep permanently open in VSCode where I put folders whenever I need to do some temporary experimentation. The scratch folder doesn't have a
I opened it again, and can confirm that this reproduces the error. Does this mean |
If it's not supported, I propose that the VSCode Go extension checks for the scenario and warns about it, since it seems totally broken? |
That is the purpose of the warning you saw:
|
But I am in a module. It's just that it's not the root of the VSCode workspace. There's a big difference. This isn't an unusual structure, either. For example, a project like flatbuffers has all its Go files in a subfolder of the root, because the whole project supports many languages. Flatbuffers doesn't have a |
I agree that it's not an unusual structure, The warning indicates that |
I understand, thanks. I've actually gotten the |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Use
gopls
via the Go extension for VSCode.What did you expect to see?
Language server should work.
What did you see instead?
Import of the package
github.com/vmihailenco/msgpack/v4
is flagged with error "could not import":Log from
gopls
has this rather obscure error:(Not sure where
package = command-line-arguments_test
comes from.) I also get this error as a VSCode notification:The module builds just fine.
Complete folder: testcase.tar.gz
gopls
log: gopls.logIf I remove the import, the import error goes away, but I still get the "You are neither in a module nor in your GOPATH" error. Here is the
gopls
log from that: gopls-2.log.The error seems unrelated to that specific import,
github.com/vmihailenco/msgpack/v4
. It also happens if I add a nested package to my module.The text was updated successfully, but these errors were encountered: