-
Notifications
You must be signed in to change notification settings - Fork 764
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
gopls: Go workspaces are no longer working correctly #2884
Comments
Hi, thanks for the report. This is strange, and clearly very confusing. However, I can't reproduce this with your reproducer. I expected something obvious, but nothing obvious jumps out at me from your logs (thanks for providing them). Could you please try the following: restart gopls ( I need more information to diagnose this. Could you please collect full RPC logs from a short session demonstrating the problem, following the instructions here: https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information Thanks! |
Unfortunately could not be resolved easily by and language server restarts, tried also nuking the config and also everything in the go env and temporary files for the system too, could not make any progress. For now the only way to make progress was to make a new system user as there was some remnant of something which was not working as expected which I could not resolve. The new user was able to work correctly, but definitely a nuclear solution to this. Would be good to figure out what happened! Log (Extension Host)
2023-08-01 13:49:06.684 [info] Extension host with pid 272058 started
2023-08-01 13:49:06.684 [info] Skipping acquiring lock for /home/joshuaring/.config/Code/User/workspaceStorage/26ac9007df1a271fa574b9172138ee02.
2023-08-01 13:49:06.801 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2023-08-01 13:49:06.812 [info] ExtensionService#_doActivateExtension golang.go, startup: false, activationEvent: 'onLanguage:go'
2023-08-01 13:49:07.264 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-08-01 13:49:07.313 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-08-01 13:49:07.346 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-08-01 13:49:07.432 [info] Eager extensions activated
2023-08-01 13:49:07.504 [error] [golang.go] provider FAILED
2023-08-01 13:49:07.517 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:07.519 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-08-01 13:49:07.525 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-08-01 13:49:07.679 [error] [golang.go] provider FAILED
2023-08-01 13:49:07.679 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:07.801 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2023-08-01 13:49:07.835 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-08-01 13:49:08.451 [error] [golang.go] provider FAILED
2023-08-01 13:49:08.452 [error] Error: no package data for import "example-foo.com"
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:10.210 [error] [golang.go] provider FAILED
2023-08-01 13:49:10.210 [error] Error: no package data for import "example-foo.com"
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:19.976 [error] [golang.go] provider FAILED
2023-08-01 13:49:19.976 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:20.101 [error] [golang.go] provider FAILED
2023-08-01 13:49:20.101 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:21.662 [error] [golang.go] provider FAILED
2023-08-01 13:49:21.662 [error] Error: context canceled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:21.663 [error] [golang.go] provider FAILED
2023-08-01 13:49:21.663 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
2023-08-01 13:49:21.811 [error] [golang.go] provider FAILED
2023-08-01 13:49:21.811 [error] Error: semantictokens are disabled
at handleResponse (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:2126:40)
at handleMessage (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1936:11)
at processMessageQueue (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1951:13)
at Immediate. (/home/joshuaring/.vscode/extensions/golang.go-0.39.1/dist/goMain.js:1927:11)
at process.processImmediate (node:internal/timers:466:21)
|
Thanks for following up, @Josh-Ring-SD. I'm afraid we don't have enough information to figure this out. Do you still have access to the old, broken user? |
I do still have access to that user yes. Open to any suggestions I ran out of ideas honestly |
It sounds like something was broken in your go environment (via Given that this appears to be some sort of isolated environment corruption, it may not be worth tracking down. |
I could not recover the environment despite resetting everything I could find, I threw in the towel here |
I had to delete my go.mod and create a new one (idk why).. setup golang is vscode looks like magic |
hey there, I'm so sorry about the confusion, but there is a set of
solutions I've been exploring with focus on only baeta and fresh
technology, emerging and emerged ,its pretty rad
…On Tue, 25 Jul 2023 at 21:22, findleyr ***@***.***> wrote:
Hi, thanks for the report. This is strange, and clearly very confusing.
However, I can't reproduce this with your reproducer. I expected something
obvious, but nothing obvious jumps out at me from your logs (thanks for
providing them).
Could you please try the following: restart gopls (Go: Restart Language
Server) in the command palette. Does the problem persist? If so, I'm very
confused.
I need more information to diagnose this. Could you please collect full
RPC logs from a short session demonstrating the problem, following the
instructions here:
https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md#collect-gopls-information
Thanks!
—
Reply to this email directly, view it on GitHub
<#2884 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BA622LRIP5KXSNUGN23VN5TXSATHBANCNFSM6AAAAAA2S4KMAU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I'm late to this party, but I had a similar problem as @Josh-Ring-SD this week. I created a Go workspace that worked fine on my MacBook, but then I experienced the same issue as OP when I cloned it to my Ubuntu workstation:
I experimented with restarting the language server and mucking about with env, with no luck. What clued me in to my issue was that while I figured out there are two solutions to this:
I'm not sure whether this is a bug or expected behaviour in the VS Code extension or gopls itself, but both have worked for me (and I'm going to stick with the latter!) |
@annybs Was just having this issue today on a fresh Go install with a workspace in an isolated directory. Compiler had no trouble building workspace sub-module A which imported sub-module B, but the VS Code extension wouldn't provide Intellisense for any of the imported objects. Running "go mod init t" in the workspace root solved the issue. @findleyr If you would like to take a look, I removed the go.mod file in the workspace root, restarted the language server, and captured the output in the attached. Same output, but after running "go mod init t" in the workspace root. Directory tree, in case that's of use to see the relationships between modules. |
@Kindred87 what is the content of your |
go 1.21.3
import (
"./TGB"
"./cwb"
) |
Sorry for missing the response from @annybs above. Something is definitely wrong here:
In other words, it looks like the same query, from the same workspace, is returning different results. Digging deeper, I found it:
The "go dir" is being computed incorrectly. That logic is here: So @Kindred87 can you please confirm that you have a Gopls should instead be truncating that expansion at a go.work file, if present. This is just a bug, though we probably don't hit it that often as |
Actually, I think we should fix this first, since the fix should be easy. I filed https://go.dev/issue/63917 to follow up. Thanks for the detailed analysis, @annybs and @Kindred87! |
Confirming that when module t
go 1.21.3 is in |
@Kindred87 to be absolutely clear, I think the Do you have a |
@findleyr Ah, I understand the distinction. There was indeed a go.mod file in the parent directory, |
Hi Guys, third year in a row i got absolutely similar problem. Here is my error message:
It's REALLY confusing and i have no idea what's happening, especially since i adding One more important thing to mention: It's always no difference between single root editor (like one folder per window) and multi-root editor (files added via And also: i have only top level modules, so there are no submodules or something like this. One module per one root. @findleyr May i ask you to look at this issue too? EDIT: what is most unfunny is that this error is completely phantom: It randomly appears and randomly dissapears without any (even theoretical) reason, why it might happen. No edits of modules, no edits, nothing. Just running a test, for example. Will be happy to provide any logs any configs, any info that will help yall 🙏 just please help |
@quenbyako with the recently closed #57979 your workspace layout should be automatically detected. However, this feature has not yet been released. Could you please try installing gopls@master?
Let us know how it goes. (as for the most unfunny part: if you are using an editor that automatically detects workspace folders, I suspect that you've opened an outer module before opening a nested module. Most editors will not detect this subdirectory as a logically distinct workspace folder) |
@findleyr Thanks for quick response! Tried it for a whole day, unfortunately it's not helping 😢 One thing i noticed: for some reason, if i opening file in two different folders, everything starts to die, for example: first opened file is in root, second one is in root also, but related to I wondering how exactly Regarding to random fails:
I never ever using sub or nested modules, so i don't thing that it ever happened in my case. all my work with go projects are always: git repo in root, only one go.mod in root, maybe some symlinks, but they never loop |
@quenbyako Can you please open a separate issue and include your workspace structure (including 1. where go.mod files are, 2. where go.work files are and what they have, and 3. gopls traces)? Thanks. |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.golang.org/x/tools/gopls v0.12.4
golang.org/x/tools/[email protected] h1:nce5etAamR46d9oNGxop1aRK5rDQ0NqcY/SHIcyfEKY=
github.com/BurntSushi/[email protected] h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/google/[email protected] h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/sergi/[email protected] h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/[email protected] h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp/[email protected] h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
golang.org/x/[email protected] h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/[email protected] h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/[email protected] h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/[email protected] h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/[email protected] h1:5PWemM67wMSPpO0Y3lOPlyvgO3z56YkZRxPFcdd300g=
golang.org/x/[email protected] h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
honnef.co/go/[email protected] h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
mvdan.cc/[email protected] h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/xurls/[email protected] h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.20.2
Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.74f6148eb9ea00507ec113ec51c489d6ffb4b771
x64
Check your installed extensions to get the version of the VS Code Go extension
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.toolsGopath:
gopath: /home/joshuaring/go
GOROOT: /usr/local/go
PATH: /home/joshuaring/.nvm/versions/node/v18.12.1/bin:/home/joshuaring/miniconda3/bin:/home/joshuaring/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/go/bin:/home/joshuaring/zig/zig-linux-x86_64-0.11.0-dev.53+cbed6bb08:/home/joshuaring/zls/bin:/home/joshuaring/apps/blender-3.3.1-linux-x64:/usr/local/go/bin:/home/joshuaring/zig/zig-linux-x86_64-0.11.0-dev.53+cbed6bb08:/home/joshuaring/zls/bin:/home/joshuaring/apps/blender-3.3.1-linux-x64:/home/joshuaring/Projects/data_team_monorepo/infrastructure/node_modules/.bin
go: /usr/local/go/bin/go: go version go1.20.6 linux/amd64
gotests: not installed
gomodifytags: not installed
impl: not installed
goplay: not installed
dlv: /home/joshuaring/go/bin/dlv (version: v1.21.0 built with go: go1.20.6)
staticcheck: not installed
gopls: /home/joshuaring/go/bin/gopls (version: v0.12.4 built with go: go1.20.2)
go env
Workspace Folder (test): /home/joshuaring/Projects/test
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/joshuaring/.cache/go-build"
GOENV="/home/joshuaring/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/joshuaring/go/pkg/mod"
GONOPROXY="github.com/silverdoorapartments"
GONOSUMDB="github.com/silverdoorapartments"
GOOS="linux"
GOPATH="/home/joshuaring/go"
GOPRIVATE="github.com/silverdoorapartments"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.6"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/home/joshuaring/Projects/go.mod"
GOWORK="/home/joshuaring/Projects/test/go.work"
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1384710745=/tmp/go-build -gno-record-gcc-switches"
Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.Describe the bug
A clear and concise description of what the bug.
package PACKAGE_NAME_HERE
line like:error:
A clear and concise description of what you expected to happen.
Steps to reproduce the behavior:
foo
andbar
go mod init example-foo.com
go mod init example-bar.com
go work init
andgo work use foo bar
go.work
like:go.mod
file in directoryfoo
:go.mod
file in the directorybar
edited to the following, so it can import the foo modulemain.go
tofoo
directory:main.go
tobar
directory:Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
output from
Go pls
:https://pastebin.com/qhb6LXGR
The text was updated successfully, but these errors were encountered: