From 2b5094fbea0dace35f55140b6f64a15e0262ccb5 Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Mon, 27 Jan 2020 14:51:22 -0500 Subject: [PATCH] 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 Reviewed-by: Rebecca Stambler TryBot-Result: Gobot Gobot --- internal/lsp/cmd/cmd.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/lsp/cmd/cmd.go b/internal/lsp/cmd/cmd.go index 25df438a9e..e0eefaf6ff 100644 --- a/internal/lsp/cmd/cmd.go +++ b/internal/lsp/cmd/cmd.go @@ -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 }