1
0
mirror of https://github.com/golang/go synced 2024-11-18 17:04:41 -07:00

internal/lsp/cmd: fix gopls check

The command line tool doesn't go through JSON RPC, so it retains type
information that's stripped in the tests. Cut the parameters down to
basic types manually for now. But I don't know why the command line
tests send RPCs if the real thing doesn't.

Fixes golang/go#36769.

Change-Id: I428b40478557ca35a7dae8d02bbcd990411f714f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216539
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Heschi Kreinick 2020-01-27 14:51:22 -05:00
parent ed30b9180d
commit 2b5094fbea

View File

@ -432,11 +432,15 @@ func (c *connection) AddFile(ctx context.Context, uri span.URI) *cmdFile {
}
func (c *connection) diagnoseFiles(ctx context.Context, files []span.URI) error {
var untypedFiles []interface{}
for _, file := range files {
untypedFiles = append(untypedFiles, string(file))
}
c.Client.diagnosticsMu.Lock()
defer c.Client.diagnosticsMu.Unlock()
c.Client.diagnosticsDone = make(chan struct{})
_, err := c.Server.NonstandardRequest(ctx, "gopls/diagnoseFiles", map[string]interface{}{"files": files})
_, err := c.Server.NonstandardRequest(ctx, "gopls/diagnoseFiles", map[string]interface{}{"files": untypedFiles})
<-c.Client.diagnosticsDone
return err
}