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: error message pop-up: "The code in the workspace failed to compile..." #40578
Comments
@shenghui0779 thanks for the report. This looks similar to golang/vscode-go#463 and it looks like the error message is from the gopls Can you please follow the gopls troubleshooting guide and share the gopls log? |
@hyangah I'm having the same problem but on Vim with coc.nvim. How can I enable gopls debug with args in coc.nvim? I've tried multiple setup without success. The |
I'm also not sure about how to pass flags to the language server in coc.nvim, but you can try running |
I have the same issue, it keeps popping out for almost every action I did |
+1 |
@leguminosa, @chrismalek: Please open new issues and provide the information requested in the |
@phongvcao I am not familiar with coc.nvim. I am guessing you can pass extra args with the |
More Information: I enabled the trace flag in vscode settings. "go.languageServerFlags": ["-rpc.trace", "-debug=localhost:6060"] Here is what my directory look like.
Output of trace
It cannot find the go.mod file nor the main file but I assure you they are there. I did notice it is showing this I am not sure if that Let me know if I can provide any other details. I am not deep into the weeds of how gopls works. |
@chrismalek: |
@stamblerre thank you. That worked. Thanks for your expertise. |
@stamblerre I haven't received any error pop-up like yesterday, are there by any means new releases / fixes already? |
@leguminosa: No, there haven't been any new releases since this issue was filed. Please open a new issue if you encounter this problem again. |
I have the same problem in my php workspace . It seems gopls also works in non go projects. What should I do? go version go1.14.4 linux/amd64 |
`[Trace - 10:35:21.869 AM] Sending request 'initialize - (0)'. [Trace - 10:35:21.876 AM] Received response 'initialize - (0)' in 6ms. [Trace - 10:35:21.879 AM] Sending notification 'initialized'. [Trace - 10:35:21.884 AM] Received request 'workspace/configuration - (1)'. [Trace - 10:35:21.885 AM] Received notification 'window/logMessage'. [Info - 10:35:21 AM] 2020/08/13 10:35:21 Build infogolang.org/x/tools/gopls 0.4.4 Go infogo version go1.14.4 linux/amd64 [Trace - 10:35:21.890 AM] Sending response 'workspace/configuration - (1)' in 5ms. [Trace - 10:35:21.921 AM] Received notification 'window/logMessage'. [Trace - 10:35:21.922 AM] Received request 'client/registerCapability - (2)'. [Info - 10:35:21 AM] 2020/08/13 10:35:21 go env for /data/workspace/phpWorkspace/testtest [Trace - 10:35:21.926 AM] Sending response 'client/registerCapability - (2)' in 3ms. [Trace - 10:35:21.931 AM] Received notification 'window/logMessage'. [Trace - 10:35:21.931 AM] Received notification 'window/logMessage'. [Error - 10:35:21 AM] 2020/08/13 10:35:21 go/packages.Load: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./ builtin]: exit status 1: go: cannot find main module, but found .git/config in /data/workspace/phpWorkspace/testtest
[Error - 10:35:21 AM] 2020/08/13 10:35:21 initial workspace load failed: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./ builtin]: exit status 1: go: cannot find main module, but found .git/config in /data/workspace/phpWorkspace/testtest [Trace - 10:35:21.938 AM] Received notification 'window/showMessage'. [Trace - 10:35:21.939 AM] Received notification 'window/logMessage'. [Trace - 10:35:21.939 AM] Received notification 'window/logMessage'. [Error - 10:35:21 AM] 2020/08/13 10:35:21 go/packages.Load: go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./]: exit status 1: go: cannot find main module, but found .git/config in /data/workspace/phpWorkspace/testtest
[Error - 10:35:21 AM] 2020/08/13 10:35:21 The code in the workspace failed to compile (see the error message below). ` |
It looks like you are using modules, but |
@stamblerre |
|
@stamblerre Same happens here, despite using workspace folders as you describe above. Some of my workspace folders contain This is the full error:
Please let me know if there's any other troubleshooting I can do to help find the root cause! |
I am facing the same issue.
|
This issue was fixed by https://golang.org/cl/248620, which has not yet been released. You can wait for the next release, or use the master version of gopls. |
The text was updated successfully, but these errors were encountered: