Skip to content

Commit 368bee8

Browse files
leitzlerstamblerre
authored andcommitted
internal/lsp: use ForTest package name when running test command
Executing the "go test" command did pass Package.PkgPath() as first argument to the go invokation before. That failed when using test packages with _test suffix. The "go test" command now use Package.ForTest() instead. Fixes golang/go#43037 Change-Id: Iea1a0e0c949a53770c1d3e1126a16a9c4952a53f Reviewed-on: https://go-review.googlesource.com/c/tools/+/275496 Trust: Pontus Leitzler <[email protected]> Run-TryBot: Pontus Leitzler <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 6543527 commit 368bee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/lsp/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func (s *Server) runTests(ctx context.Context, snapshot source.Snapshot, uri pro
311311
if len(pkgs) == 0 {
312312
return fmt.Errorf("package could not be found for file: %s", uri.SpanURI().Filename())
313313
}
314-
pkgPath := pkgs[0].PkgPath()
314+
pkgPath := pkgs[0].ForTest()
315315

316316
// create output
317317
buf := &bytes.Buffer{}

0 commit comments

Comments
 (0)