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 <adonovan@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Robert Findley 2022-09-22 14:21:49 -04:00
parent be3ff020ad
commit 62ae58610f
1 changed files with 8 additions and 0 deletions

View File

@ -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())
}