Closed
Description
What version of Go are you using (go version
)?
$ go version go version devel +add45938b5 Thu Nov 19 19:35:35 2020 +0000 darwin/amd64 $ go list -m golang.org/x/tools golang.org/x/tools/gopls golang.org/x/tools v0.0.0-20201204222352-654352759326 golang.org/x/tools/gopls v0.0.0-20201204222352-654352759326
What did you do?
Triggered the Go Test command in a package where the test file had a package name ending with _test
.
$ cd (mktemp -d) && go mod init example.com/foo
$ cat > main_test.go <<EOF
package main_test
import "testing"
func TestFoo(t *testing.T) {}
EOF
What did you expect to see?
Test running, no module lookup.
What did you see instead?
Test not running, failed module lookup for package example.com/foo_test
.
[Trace - 20:52:39.712 PM] Sending request 'textDocument/codeAction - (5)'.
Params: {"textDocument":{"uri":"file:///private/var/folders/j4/l2j99h6d5qd6knjlllql0bb80000gn/T/tmp.gwQi3tbY/main_t
est.go"},"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":29}},"context":{"diagnostics":null,"
only":["goTest"]}}
[Trace - 20:52:39.714 PM] Received response 'textDocument/codeAction - (5)' in 2ms.
Result: [{"title":"test","kind":"goTest","disabled":{"reason":""},"edit":{},"command":{"title":"Run test(s)","comma
nd":"gopls.test","arguments":["file:///private/var/folders/j4/l2j99h6d5qd6knjlllql0bb80000gn/T/tmp.gwQi3tbY/main_te
st.go",["TestFoo"],null]}}]
[Trace - 20:52:39.715 PM] Sending request 'workspace/executeCommand - (6)'.
Params: {"command":"gopls.test","arguments":["file:///private/var/folders/j4/l2j99h6d5qd6knjlllql0bb80000gn/T/tmp.g
wQi3tbY/main_test.go",["TestFoo"],null],"workDoneToken":"govim5577006791947779410"}
[Trace - 20:52:39.717 PM] Received response 'workspace/executeCommand - (6)' in 1ms.
Result: null
[Trace - 20:52:39.717 PM] Received notification '$/progress'.
Params: {"token":"govim5577006791947779410","value":{"cancellable":true,"kind":"begin","message":"Running...","title":"Run test(s)"}}
[Trace - 20:52:39.821 PM] Received notification '$/progress'.
Params: {"token":"govim5577006791947779410","value":{"cancellable":true,"kind":"report","message":"go: finding module for package example.com/foo_test"}}
[Trace - 20:52:39.822 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/12/06 20:52:39 go: finding module for package example.com/foo_test\n\n\toperation=\"test\"\n"}
[Trace - 20:52:39.822 PM] Received notification '$/progress'.
Params: {"token":"govim5577006791947779410","value":{"cancellable":true,"kind":"report","message":"cannot find module providing package example.com/foo_test: module lookup disabled by GOPROXY=off"}}