golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.78k stars 728 forks source link

ui: open gopls trace option doesn't work #3236

Closed b-kaiser closed 3 months ago

b-kaiser commented 3 months ago
Version Information
* Distribution: - Fedora Linux 38 and 39 (I upgraded to 39 in an attempt to troubleshoot the issue myself) - EDIT: By now, reproduced on two different machines running Fedora Linux * Installation: - VS Code installation via rpm as instructed on the [VS code website](https://code.visualstudio.com/docs/setup/linux) * (Optionally) other extensions (EDIT: By now reproduced the bug without extensions): - C/C++, C/C++ Extension Pack, C/C++ Themes - CMake, CMake Tools - GitHub Copilot, GitHub Copilot Chat - (Disabled: VSCode Neovim) * Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.21.7 linux/amd64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - `golang.org/x/tools/gopls master@go: go1.21.0` * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - `1.87.1 1e790d77f81672c49be070e04474901747115651 x64` * Check your installed extensions to get the version of the VS Code Go extension - `v0.41.1` * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: /home/benjamin/go GOROOT: /usr/lib/golang PATH: /usr/lib/golang/bin:/home/benjamin/.elan/bin:/home/benjamin/.elan/bin:/home/benjamin/.elan/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/benjamin/.cargo/bin/:/home/benjamin/.local/bin:/home/benjamin/programms/zig-linux-x86_64-0.11.0-dev.3786+8dcb4a3dc PATH (vscode launched with): /home/benjamin/.elan/bin:/home/benjamin/.elan/bin:/home/benjamin/.elan/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/benjamin/.cargo/bin/:/home/benjamin/.local/bin:/home/benjamin/programms/zig-linux-x86_64-0.11.0-dev.3786+8dcb4a3dc ## Tools go: /usr/lib/golang/bin/go: go version go1.21.7 linux/amd64 gopls: /home/benjamin/go/bin/gopls (version: v0.15.1 built with go: go1.21.7) gotests: /home/benjamin/go/bin/gotests (version: v1.6.0 built with go: go1.21.7) gomodifytags: /home/benjamin/go/bin/gomodifytags (version: v1.16.0 built with go: go1.21.7) impl: /home/benjamin/go/bin/impl (version: v1.1.0 built with go: go1.21.7) goplay: /home/benjamin/go/bin/goplay (version: v1.0.0 built with go: go1.21.7) dlv: /home/benjamin/go/bin/dlv (version: v1.22.1 built with go: go1.21.7) staticcheck: /home/benjamin/go/bin/staticcheck (version: v0.4.7 built with go: go1.21.7) ## Go env Workspace Folder (endgame): /home/benjamin/endgame GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/benjamin/.cache/go-build' GOENV='/home/benjamin/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/benjamin/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/benjamin/go' GOPRIVATE='' GOPROXY='direct' GOROOT='/usr/lib/golang' GOSUMDB='off' GOTMPDIR='' GOTOOLCHAIN='local' GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.7' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/home/benjamin/endgame/go.mod' GOWORK='' 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 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2729943877=/tmp/go-build -gno-record-gcc-switches' ```

Go related settings:

    \\ Hoping to get more information (bug doesn't rely on them):
    "go.trace.server": "verbose",  
    "go.languageServerFlags": [
        "-rpc.trace",
        "-logfile",
        "/tmp/gopls.log"
    ],

Expected behaviour

The bug

The zap symbol next to the go version in the status bar does not disappear, even after updating all analysis tools. Clicking on it opens the command panel with the following options:

Steps to reproduce the behaviour:

  1. Install go extension
  2. Open some .go file
  3. Download and Install go tool chain as instructed.
  4. See error

Screenshots or recordings

Screencast from 2024-03-08 10-50-08.webm

b-kaiser commented 3 months ago

Following instructions I saw in other questions, I add more information. I first observed the issue after reinstalling VS code on one machine. Previously, I used the flatpak version of VS code. However, I had mutliple issues with the flatpak version including that the go extension was unable to locate go. After some troubleshooting, I decided not to debug issues that are likely related to flatpak and go for the recommended way of installing VS code.

Hence, I started VS code from a more or less clean state. To confirm that the bug is not specific to some changes I made before, I installed VS code on a different machine with a basically new Fedora Installation. On that machine, neither go, nor VS code had been installed before. Hence, I suspect, I did not mess up anything as the same bug appeared. Later today, I will install Linux Mint on that machine and check if I get the same bug. Below is the gopls (server) output log on machine number 1.

[Info  - 16:29:56] 2024/03/08 16:29:56 go info for /home/benjamin/endgame
(view type GoModView)
(root dir /home/benjamin/endgame)
(go version go version go1.21.7 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/benjamin/.cache/go-build GOMODCACHE:/home/benjamin/go/pkg/mod GOPATH:/home/benjamin/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:21 GoVersionOutput:go version go1.21.7 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

[Info  - 16:29:58] 2024/03/08 16:29:57 go/packages.Load #1
    snapshot=0
    directory=file:///home/benjamin/endgame
    query=[/home/benjamin/endgame/... builtin]
    packages=2

[Info  - 16:29:58] 2024/03/08 16:29:57 go/packages.Load #1: updating metadata for 240 packages

[Error - 16:29:58] Request textDocument/semanticTokens/range failed.
  Message: semantictokens are disabled
  Code: 0 
[Error - 16:29:59] Request textDocument/semanticTokens/full failed.
  Message: semantictokens are disabled
  Code: 0 
[Info  - 16:30:02] 2024/03/08 16:30:01 go info for /home/benjamin/endgame
(view type GoModView)
(root dir /home/benjamin/endgame)
(go version go version go1.21.7 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/benjamin/.cache/go-build GOMODCACHE:/home/benjamin/go/pkg/mod GOPATH:/home/benjamin/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:21 GoVersionOutput:go version go1.21.7 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

[Info  - 16:30:02] 2024/03/08 16:30:02 go/packages.Load #2
    snapshot=0
    directory=file:///home/benjamin/endgame
    query=[/home/benjamin/endgame/... builtin]
    packages=2

[Info  - 16:30:02] 2024/03/08 16:30:02 go/packages.Load #2: updating metadata for 240 packages

[Error - 16:30:02] Request textDocument/codeAction failed.
  Message: context canceled
  Code: 0 
[Info  - 16:30:03] 2024/03/08 16:30:03 go info for /home/benjamin/endgame
(view type GoModView)
(root dir /home/benjamin/endgame)
(go version go version go1.21.7 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/benjamin/.cache/go-build GOMODCACHE:/home/benjamin/go/pkg/mod GOPATH:/home/benjamin/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:21 GoVersionOutput:go version go1.21.7 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

[Info  - 16:30:04] 2024/03/08 16:30:04 go/packages.Load #3
    snapshot=0
    directory=file:///home/benjamin/endgame
    query=[/home/benjamin/endgame/... builtin]
    packages=2

[Info  - 16:30:04] 2024/03/08 16:30:04 go/packages.Load #3: updating metadata for 240 packages

[Info  - 16:30:04] 2024/03/08 16:30:04 go info for /home/benjamin/endgame
(view type GoModView)
(root dir /home/benjamin/endgame)
(go version go version go1.21.7 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/benjamin/.cache/go-build GOMODCACHE:/home/benjamin/go/pkg/mod GOPATH:/home/benjamin/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:21 GoVersionOutput:go version go1.21.7 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

[Info  - 16:30:04] 2024/03/08 16:30:04 go/packages.Load #4
    snapshot=0
    directory=file:///home/benjamin/endgame
    query=[/home/benjamin/endgame/... builtin]
    packages=2

[Info  - 16:30:04] 2024/03/08 16:30:04 go/packages.Load #4: updating metadata for 240 packages

[Info  - 16:30:29] 2024/03/08 16:30:29 background imports cache refresh starting

[Info  - 16:30:29] 2024/03/08 16:30:29 background refresh finished after 575.832762ms

[Error - 16:30:31] Request textDocument/semanticTokens/range failed.
  Message: semantictokens are disabled
  Code: 0 
[Info  - 16:30:32] 2024/03/08 16:30:32 background imports cache refresh starting

[Info  - 16:30:32] 2024/03/08 16:30:32 background refresh finished after 59.698279ms

[Info  - 16:30:34] 2024/03/08 16:30:34 background imports cache refresh starting

[Info  - 16:30:34] 2024/03/08 16:30:34 background refresh finished after 56.841416ms
hyangah commented 3 months ago

Sorry I am confused. What made you think there should be "No zap symbol next to the go version when all go tools are up to date"? Is there any documentation or misleading information out there? We need to fix the doc if it's in our documentation.

The zap symbol indicates gopls is up and running.

b-kaiser commented 3 months ago

OK, good to know. I completely misinterpreted the zap symbol. I believe to have read that false interpretation somewhere in the documentation, but maybe I am mistaken. I will search for this in the documentation and close the issue this week If I do not find it, because it is not there.

However, why is nothing happening, when clicking on Open gopls trace?

Thank you for the quick response!

gopherbot commented 3 months ago

Change https://go.dev/cl/571318 mentions this issue: extension/src/goStatus: fix quick pick for gopls trace open