go: x/tools/gopls: slow packages.Loads with cgo

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

  • Run go version to get version of Go
    • go 1.15.6
  • Run gopls -v version to get version of Gopls if you are using the language server.
    • v0.6.0-pre1 and v0.5.5
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • Version: 1.53.0-insider Commit: 76436a4d43566cd313629799e2ec51b4d00caa64 Date: 2020-12-11T17:46:02.603Z Electron: 11.0.3 Chrome: 87.0.4280.67 Node.js: 12.18.3 V8: 8.7.220.25-electron.0 OS: Darwin x64 20.1.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.19.1 as well as go-nightly v2020.12.814
  • Run go env to get the go development environment details
    • GO111MODULE=“” GOARCH=“amd64” GOBIN=“” GOCACHE=“/home/toni/.cache/go-build” GOENV=“/home/toni/.config/go/env” GOEXE=“” GOFLAGS=“” GOHOSTARCH=“amd64” GOHOSTOS=“linux” GOINSECURE=“” GOMODCACHE=“/home/toni/go/pkg/mod” GONOPROXY=“” GONOSUMDB=“” GOOS=“linux” GOPATH=“/home/toni/go” GOPRIVATE=“” GOPROXY=“https://proxy.golang.org,direct” GOROOT=“/home/toni/sdk/go1.15.6” GOSUMDB=“sum.golang.org” GOTMPDIR=“” GOTOOLDIR=“/home/toni/sdk/go1.15.6/pkg/tool/linux_amd64” GCCGO=“gccgo” AR=“ar” CC=“gcc” CXX=“g++” CGO_ENABLED=“1” GOMOD=“/home/toni/go/src/github.com/davidbyttow/govips/go.mod” CGO_CFLAGS=“-g -O2” CGO_CPPFLAGS=“” CGO_CXXFLAGS=“-g -O2” CGO_FFLAGS=“-g -O2” CGO_LDFLAGS=“-g -O2” PKG_CONFIG=“pkg-config” GOGCCFLAGS=“-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build840047076=/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"] or gopls prefixes. “go.formatTool”: “goimports”, “go.useLanguageServer”: true, “go.coverageDecorator”: { “type”: “gutter” }, “go.coverOnSingleTest”: true, “go.coverOnSingleTestFile”: true, “go.coverageOptions”: “showUncoveredCodeOnly”, “editor.codeActionsOnSave”: null

Describe the bug

Every now and then, for months now with various Go extensions and Go nightly extensions, when I save a Go file, VS code stalls for a couple of minutes saying “Getting code actions from Go”

The stall is about two minutes. As you can see from the screenshot, editor.CodeActionsOnSave is null.

Steps to reproduce the behavior:

  1. Edit go file
  2. Save go file
  3. Every 20th time VS code hangs for a few minutes, saving the file

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

Screenshot 2020-12-12 at 21 48 47

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I think this may in fact be fixed at last (for me at least). Re-enabled Language Server in vscode. I am on latest version go gopls available to me anyways: golang.org/x/tools/gopls v0.12.1 golang.org/x/tools/gopls@v0.12.2 h1:s4mznBqCHVHeuTYjxGYJhsW3Wp4FYon8YAqiJlwlpTY=

I now have a pleasant debugging experience in the project I was trying to develop in vscode that prior caused my machine to brick.

Thanks for all the hard work that went into gopls to improve the performance.