Skip to content

x/tools/gopls: saving is very slow with the latest update #45092

@evanw

Description

@evanw

What version of Go are you using (go version)?

$ go version
go version go1.16.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/evan/Library/Caches/go-build"
GOENV="/Users/evan/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/evan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/evan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/evan/dev/esbuild/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j6/np400cw17sz0n5ljd67byrzw0000gn/T/go-build1589752302=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I use the Go extension in Visual Studio Code (v0.23.2) which uses gopls (v0.6.7) on a project with a single dependency.

What did you expect to see?

The Go extension formats code and automatically inserts missing imports whenever I save. I expect this to feel instant, and it has been instant in the past.

What did you see instead?

Something changed recently. Now saving a Go file takes a really long time (e.g. 7 seconds) and causes Visual Studio Code to show a Saving 'resolver.go': Getting code actions from ''Go'' (configure). message in the corner. This is really breaking my flow because it means I constantly have to wait in between adjusting code and trying it out.

I would love for this to be fixed of course, but I would also love to have a workaround in the meantime. For example, I assume this is due to automatic import insertion and not due to code formatting. Is there a way I can disable the slow part but just keep code formatting on save? Maybe there is some cache somewhere that has gotten filled up and can be cleared to make this go faster?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions