golang / vscode-go

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

[macOS] gopls client: couldn't create connection to server #3179

Closed rennsax closed 4 months ago

rennsax commented 4 months ago

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - go version go1.22.0 darwin/arm64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - zsh: killed ./gopls -v version * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.86.2 * Check your installed extensions to get the version of the VS Code Go extension - v0.41.0 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: /Users//.local/share/go GOROOT: /opt/homebrew/Cellar/go/1.22.0/libexec PATH: /opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/python@3.12/libexec/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin:/Users//.local/bin:/Users//.orbstack/bin ## Tools go: /opt/homebrew/bin/go: go version go1.22.0 darwin/arm64 gopls: /Users//.local/share/go/bin/gopls (version: v0.14.2 built with go: go1.22.0) gotests: not installed gomodifytags: not installed impl: not installed goplay: not installed dlv: not installed staticcheck: /Users//.local/share/go/bin/staticcheck (version: v0.4.6 built with go: go1.22.0) ## Go env Workspace Folder (try-go): /Users//codeplace/playground/try-go GO111MODULE='' GOARCH='arm64' GOBIN='' GOCACHE='/Users//Library/Caches/go-build' GOENV='/Users//Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users//.cache/go/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users//.local/share/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/opt/homebrew/Cellar/go/1.22.0/libexec' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.0/libexec/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.22.0' GCCGO='gccgo' AR='ar' CC='/opt/homebrew/opt/llvm/bin/clang' CXX='/opt/homebrew/opt/llvm/bin/clang++' CGO_ENABLED='1' GOMOD='/dev/null' 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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/43/15hv0c3n3sq3svxrgxbr2ggw0000gn/T/go-build3464914985=/tmp/go-build -gno-record-gcc-switches -fno-common' ```

Share the Go related settings you have added/edited

I do not add anything.

Describe the bug

gopls cannot be connected. Even though I go installed the latest version of gopls, the extension reminds me that the gopls is outdated.

Steps to reproduce the behavior:

Open any Go project and enable vscode-go extension.

Screenshots or recordings

image

gopls(server):

image

gopls CLI is broken?

image

rennsax commented 4 months ago

https://github.com/golang/vscode-go/issues/3085#issuecomment-1850368404 This works for me, in case anyone comes here looking for help.