$ go version
go version devel +135c9f45ec Wed Mar 31 04:13:44 2021 +0000 linux/amd64
$ go list -m golang.org/x/tools
$ go list -m golang.org/x/tools/gopls
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
A recent fix in govim means that when Vim shuts down, it triggers a shutdown sequence as follows:
User types :q (or equivalent)
Vim send govim a VimLeave event, which fires before exiting Vim, and blocks on the processing of this event
govim does some of its own tidy up
govim calls the gopls.Shutdown method, blocking on its return
govim does some more tidying up before finally returning to Vim
With the VimLeave event now processed, Vim exits
This fix ensures that govim and gopls properly tidy up (temporary files) after themselves.
However, this appears to have highlighted an issue: that calling Shutdown does not interrupt existing "work" that gopls might be doing. Two things point to this being the case:
Per #41558 (comment), Vim does not exit until such time as the initial package load has completed (the Shutdown call appears to be blocked whilst the package load is happening)
As reported by @mvdan on Slack, "work" triggered off the back of a file change "storm" also cannot be interrupted, i.e. Vim does not exit until all the file change notifications and corresponding work have been handled.
As noted on Slack, in the case of the second issue there are many other issues at play, but it would still seem, like in the first case, desirable for Shutdown to be able to interrupt anything that gopls is doing.
For now we have a workaround in govim, to set a deadline of 500ms for the Shutdown call to be processed. The impact of this being that if the call to Shutdown exceed the deadline, gopls' temporary files (and other things?) are not tidied up.
What did you expect to see?
Shutdown being handled immediately, and not blocking on current "work".