From 62ae58610f8ab1524dda5a51d8d7bc0ce2373acd Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Thu, 22 Sep 2022 14:21:49 -0400 Subject: [PATCH] gopls/test: disable stderr output for command line tests as well Suppress output in gopls command line tests, similarly to CL 431843. For golang/go#54845 Change-Id: I7f1e1de52c9a8fb0d902bfdd61bc99d4e2e308b9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/432955 Reviewed-by: Alan Donovan Run-TryBot: Robert Findley TryBot-Result: Gopher Robot gopls-CI: kokoro --- gopls/test/gopls_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gopls/test/gopls_test.go b/gopls/test/gopls_test.go index 248a03b789..95534d4432 100644 --- a/gopls/test/gopls_test.go +++ b/gopls/test/gopls_test.go @@ -13,12 +13,20 @@ import ( "golang.org/x/tools/gopls/internal/lsp/source" "golang.org/x/tools/gopls/internal/lsp/tests" "golang.org/x/tools/internal/bug" + "golang.org/x/tools/internal/event" "golang.org/x/tools/internal/testenv" ) func TestMain(m *testing.M) { bug.PanicOnBugs = true testenv.ExitIfSmallMachine() + + // Set the global exporter to nil so that we don't log to stderr. This avoids + // a lot of misleading noise in test output. + // + // See also ../internal/lsp/lsp_test.go. + event.SetExporter(nil) + os.Exit(m.Run()) }