go: x/tools/gopls: remove workspace packages that no longer exist
What version of Go are you using (go version)?
$ go version go version go1.13 linux/amd64
Does this issue reproduce with the latest release?
Yes (v0.16.1)
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="auto" GOARCH="amd64" GOBIN="" GOCACHE="/home/nakama/.cache/go-build" GOENV="/home/nakama/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/nakama/.gvm/pkgsets/go1.13/global" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/nakama/.gvm/gos/go1.13" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/nakama/.gvm/gos/go1.13/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/nakama/workspace/tokopedia/rechargeapp/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-build894095586=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Nothing. The error message pops up frequently out of nowhere, almost randomly without any root cause / action trigger (when I’m changing branch, just moving mouse, or even without doing anything)
What did you expect to see?
Nothing
What did you see instead?

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 16 (5 by maintainers)
Commits related to this issue
- internal/lsp/cache: use a map to track package paths to reload I could've sworn I'd already submitted this CL earlier. We've been sending duplicate package paths to go/packages for no reason. Update... — committed to golang/tools by stamblerre 4 years ago
- internal/lsp/regtest: reproduce edge cases when creating new files This adds tests for golang/go#40690, as well as a case for a bug in changing package names. Updates golang/go#40690 Change-Id: I51... — committed to golang/tools by stamblerre 4 years ago
Thanks for the repro case, @cretz. I am able to reproduce. I think that https://golang.org/cl/250949 should fix the pop-up, but I’ll investigate the underlying causes here.
I am experiencing this issue and have narrowed down when it occurs. It occurs whenever you have a package where the only test files are in package
_testinstead of the same package as the rest of the files. For example, if you havefoo/foo.gowithpackage foo, andfoo/foo_test.goaspackage foo_test, this error will come up as:But if you make any test in that same dir that uses the same package (e.g.
foo/bar_test.gowithpackage foo) it will work. From the outside, it makes sense from the message why this bug exists. The tool is erroneously looking for afoo.testpackage if any test is present, not realizing that all tests might be in a separatefoo_test.testpackage.EDIT: To repeatedly replicate after a restart/reload, you may have to create that
foo/bar_test.gowithpackage foo, then delete it.