mirror of https://github.com/golang/go.git
gopls/internal/lsp: suppress noisy log output in tests
Disable logging for lsp tests: logs are not scoped to the failing test and are therefore misleading. For golang/go#54845 Change-Id: I232e4cfc114382121923e8e697452007793ec3c9 Reviewed-on: https://go-review.googlesource.com/c/tools/+/431843 gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
df2eb9381f
commit
f901623876
|
|
@ -15,14 +15,15 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/tools/internal/bug"
|
||||
"golang.org/x/tools/gopls/internal/lsp/cache"
|
||||
"golang.org/x/tools/gopls/internal/lsp/command"
|
||||
"golang.org/x/tools/internal/diff"
|
||||
"golang.org/x/tools/gopls/internal/lsp/protocol"
|
||||
"golang.org/x/tools/gopls/internal/lsp/source"
|
||||
"golang.org/x/tools/gopls/internal/lsp/tests"
|
||||
"golang.org/x/tools/gopls/internal/lsp/tests/compare"
|
||||
"golang.org/x/tools/internal/bug"
|
||||
"golang.org/x/tools/internal/diff"
|
||||
"golang.org/x/tools/internal/event"
|
||||
"golang.org/x/tools/internal/span"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
)
|
||||
|
|
@ -30,6 +31,14 @@ import (
|
|||
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.
|
||||
//
|
||||
// TODO(rfindley): investigate whether we can/should capture logs scoped to
|
||||
// individual tests by passing in a context with a local exporter.
|
||||
event.SetExporter(nil)
|
||||
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue