internal/lsp: do not treat failed go test commands as errors
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 <leitzler@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Daniel Martà <mvdan@mvdan.cc>
diff --git a/internal/lsp/command.go b/internal/lsp/command.go
index 20ae57f..b205fc0 100644
--- a/internal/lsp/command.go
+++ b/internal/lsp/command.go
@@ -355,14 +355,12 @@
} 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,
})
}