diff --git a/internal/lsp/cmd/check_test.go b/internal/lsp/cmd/check_test.go index 629c073e796..9771ca922a1 100644 --- a/internal/lsp/cmd/check_test.go +++ b/internal/lsp/cmd/check_test.go @@ -9,6 +9,7 @@ import ( "strings" "testing" + "golang.org/x/tools/internal/lsp/cmd" "golang.org/x/tools/internal/lsp/tests" "golang.org/x/tools/internal/span" "golang.org/x/tools/internal/tool" @@ -21,8 +22,9 @@ func (r *runner) Diagnostics(t *testing.T, data tests.Diagnostics) { } fname := uri.Filename() args := []string{"-remote=internal", "check", fname} + app := cmd.New("gopls-test", r.data.Config.Dir, r.data.Exported.Config.Env) out := captureStdOut(t, func() { - tool.Main(r.ctx, r.app, args) + tool.Main(r.ctx, app, args) }) // parse got into a collection of reports got := map[string]struct{}{} diff --git a/internal/lsp/cmd/cmd_test.go b/internal/lsp/cmd/cmd_test.go index 3abc05c7304..88847e77bd9 100644 --- a/internal/lsp/cmd/cmd_test.go +++ b/internal/lsp/cmd/cmd_test.go @@ -15,14 +15,12 @@ import ( "testing" "golang.org/x/tools/go/packages/packagestest" - "golang.org/x/tools/internal/lsp/cmd" "golang.org/x/tools/internal/lsp/tests" ) type runner struct { exporter packagestest.Exporter data *tests.Data - app *cmd.Application ctx context.Context } @@ -37,7 +35,6 @@ func testCommandLine(t *testing.T, exporter packagestest.Exporter) { r := &runner{ exporter: exporter, data: data, - app: cmd.New("gopls-test", data.Config.Dir, data.Exported.Config.Env), ctx: tests.Context(t), } tests.Run(t, r, data) diff --git a/internal/lsp/cmd/definition_test.go b/internal/lsp/cmd/definition_test.go index 992149d0fea..480a8cc1103 100644 --- a/internal/lsp/cmd/definition_test.go +++ b/internal/lsp/cmd/definition_test.go @@ -83,7 +83,8 @@ func (r *runner) Definition(t *testing.T, data tests.Definitions) { uri := d.Src.URI() args = append(args, fmt.Sprint(d.Src)) got := captureStdOut(t, func() { - tool.Main(r.ctx, r.app, args) + app := cmd.New("gopls-test", r.data.Config.Dir, r.data.Exported.Config.Env) + tool.Main(r.ctx, app, args) }) got = normalizePaths(r.data, got) if mode&jsonGoDef != 0 && runtime.GOOS == "windows" {