Repository: go
Issue: x/tools/gopls: invalid error messages when switching between tags in kubernetes
Labels: gopls,Tools

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
1.15.5
gopls :  0.5.5 
gopls flags: -rpc.trace



</pre>

### Does this issue reproduce with the latest release?
1. open  kubernets folder that code in the git tag 1.18.6, wait gopls  server finished
2. checkout  to 1.19.0, that gopls server  can not get functions  document  it fallback to use getdoc
3. do "go: restart language server", it is not reponsed and retry again
4. wait some moment, vscode go extension report `The language server is not able to serve any features. Initialization failed: Error: Connection got disposed..`


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xiaoqing\AppData\Local\go-build
set GOENV=C:\Users\xiaoqing\AppData\Roaming\go\env  
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\git\kubernetes\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\xiaoqing\AppData\Local\Temp\go-build065131578=/tmp/go-build -gno-record-gcc-switches
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->
many go.exe process  find in task manger


### What did you expect to see?

checkout new branch should restart gopls server

### What did you see instead?
gopls stop work and  hover text not show anything after click "go: restart language server"
I can do reload windows to slove this problem 
gopls server log
[gopls-stop-work-on-checkout-new-branch.txt](https://github.com/golang/go/files/5647139/gopls-stop-work-on-checkout-new-branch.txt)

vscode settings：
workspace
```
{
    //"go.buildTags": "linux",
    "go.toolsEnvVars": {
    "GOFLAGS": "-tags=linux -mod=mod"
    },
}
```
user
```
{
    "files.eol": "\n",
    "go.useCodeSnippetsOnFunctionSuggest": true,
    "editor.renderWhitespace": "all",
    "editor.renderControlCharacters": true,
    "files.autoSave": "afterDelay",
    "editor.wordWrap": "on",
    "go.toolsEnvVars": {
    
    //    "GOFLAGS": "-tags=linux"
    },
    "go.languageServerFlags": [
        "-rpc.trace",
    ],
    "go.languageServerExperimentalFeatures": {


        "diagnostics": true,
        "documentLink": true
    },
    "workbench.settings.openDefaultSettings": true,
    "editor.minimap.enabled": false,
    "go.formatTool": "goimports",
    "go.useLanguageServer": true,
}
```