From 69daaf961d656fa9386db3c8b1d77c4295e82947 Mon Sep 17 00:00:00 2001 From: Pontus Leitzler Date: Wed, 11 Nov 2020 13:12:26 +0100 Subject: [PATCH] internal/lsp: do not treat failed go test commands as errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "go test" command invoked via code action/code lens performs a ShowMessage callback to the client when the test is done. Previously it did set severity to "Error" when the test failed, but a failing test isn't a error condition per se. This changes the result to be of severity Info for both successful and failed test invocations. Change-Id: Ib76558d98a434c706823617b9901a88e53864319 Reviewed-on: https://go-review.googlesource.com/c/tools/+/269257 Run-TryBot: Pontus Leitzler gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Robert Findley Trust: Daniel Martí --- internal/lsp/command.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/lsp/command.go b/internal/lsp/command.go index 20ae57faeb..b205fc0bfd 100644 --- a/internal/lsp/command.go +++ b/internal/lsp/command.go @@ -355,14 +355,12 @@ func (s *Server) runTests(ctx context.Context, snapshot source.Snapshot, uri pro } else if failedBenchmarks > 0 { message = fmt.Sprintf("%d / %d benchmarks failed", failedBenchmarks, len(benchmarks)) } - messageType := protocol.Info if failedTests > 0 || failedBenchmarks > 0 { - messageType = protocol.Error message += "\n" + buf.String() } return s.client.ShowMessage(ctx, &protocol.ShowMessageParams{ - Type: messageType, + Type: protocol.Info, Message: message, }) }