1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:56:12 -07:00

internal/lsp/regtest: fix context for shared server

The shared server was executing on ctx.Background(), which meant it
didn't have a debug.Instance. This resulted in logs being printed to
stderr, due to the fallback behavior of the global exporter.

Fixes golang/go#39130

Change-Id: Ibb968f78d69752452bec71a7abeff808b1cccb04
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237583
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
Rob Findley 2020-06-11 12:35:31 -04:00 committed by Robert Findley
parent 7ffd523398
commit 782c6b3cc7

View File

@ -248,7 +248,7 @@ func (r *Runner) getTestServer() *servertest.TCPServer {
ctx := context.Background() ctx := context.Background()
ctx = debug.WithInstance(ctx, "", "") ctx = debug.WithInstance(ctx, "", "")
ss := lsprpc.NewStreamServer(cache.New(ctx, nil)) ss := lsprpc.NewStreamServer(cache.New(ctx, nil))
r.ts = servertest.NewTCPServer(context.Background(), ss, nil) r.ts = servertest.NewTCPServer(ctx, ss, nil)
} }
return r.ts return r.ts
} }