Skip to content

x/tools/gopls: becomes slow in vscode after creating then deleting the $gopath/src and the vendor folder #62021

Description

@NewUserHa

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

$ go version
go version go1.21.0 windows/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
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\User\AppData\Local\go-build
set GOENV=C:\Users\User\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\User\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\User\go
set GOPRIVATE=
set GOPROXY=https://goproxy.io,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.21.0
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\User\AppData\Local\Temp\go-build959162870=/tmp/go-build -gno-record-gcc-switches

What did you do?

  1. having a .go and .mod file, and the content doesn't matter. open it with vscode. ( at this time "go to def" and "format" functions work normally)
  2. using go vendor create the vendor folder. ( this requires you to have at least one 3rd party library imported )
  3. also copying the content of the vendor folder to $gopath/src.
  4. delete the 2 folders created by step 2 and step 3.
  5. "go to def" and "format" respond very slowly it takes about minutes to format once.

What did you expect to see?

"go to def" and "format" work normally as always.

What did you see instead?

"go to def" and "format" respond very slowly or becomes unresponsive.

note:

  1. I didn't test which folder actually causes this issue, but I guess both of them can.
  2. the reason for doing step 2 and 3 are for the repl tool yaegi to import 3rd party package to work, but it fails, maybe because of windows according to some comments from its github repo issues that it only tested on linux and not like to support windows.
  3. another trivial issue in step 5 is that there's also a popup at right bottom corner says "saving .go something configuration". this popup also appeared sometimes before, but the configuration is empty if you click the goto setting url

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions