Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/gopls: no packages found for *_test.go in specific package #32812

Closed
tonyghita opened this issue Jun 27, 2019 · 4 comments
Closed

x/tools/cmd/gopls: no packages found for *_test.go in specific package #32812

tonyghita opened this issue Jun 27, 2019 · 4 comments

Comments

@tonyghita
Copy link

@tonyghita tonyghita commented Jun 27, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes, on 9947fec.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tonyghita/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/tonyghita/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.6/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gv/vdmq3_l541b_0lq_ds37xslnzgdpkw/T/go-build938807687=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Open VS Code with one test file open.

What did you expect to see?

I expected to see (any) language server functionality.

What did you see instead?

The language server hangs, repeatedly checking for the package, but claiming it does not exist. The issue happens only in this package—I'm not able to reproduce the issue elsewhere in the codebase.

2019/06/27 11:46:55 Debug serving on port: 6060
[Info  - 11:46:56 AM] Build info
<truncated, available above>

[Error - 11:47:02 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:04 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:06 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:06 AM] Request textDocument/documentSymbol failed.
  Message: no AST for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
  Code: 0 
[Error - 11:47:08 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:09 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:10 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:10 AM] Request textDocument/codeAction failed.
  Message: no file information for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
  Code: 0 
[Error - 11:47:12 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:13 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:13 AM] Request textDocument/documentLink failed.
  Message: no AST for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
  Code: 0 
[Error - 11:47:14 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:15 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:15 AM] Request textDocument/documentSymbol failed.
  Message: no AST for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
  Code: 0 
[Error - 11:47:17 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:18 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
[Error - 11:47:18 AM] Request textDocument/documentSymbol failed.
  Message: no AST for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go
  Code: 0 
[Error - 11:47:19 AM] unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go

and on and on...

@gopherbot gopherbot added this to the Unreleased milestone Jun 27, 2019
@gopherbot gopherbot added the gopls label Jun 27, 2019
@tonyghita
Copy link
Author

@tonyghita tonyghita commented Jun 27, 2019

Passing the -rpc.trace flag, I see:

2019/06/27 12:51:27 Debug serving on port: 6060
[Trace - 12:51:27 PM] Sending request 'initialize - (0)'.
Params: {"processId":17451,"rootPath":"/Users/tonyghita/go/src/github.com/org/manyfiles","rootUri":"file:///Users/tonyghita/go/src/github.com/org/manyfiles","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"]}},"definition":{"dynamicRegistration":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true},"documentLink":{"dynamicRegistration":true},"typeDefinition":{"dynamicRegistration":true},"implementation":{"dynamicRegistration":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true}}},"initializationOptions":{"funcSnippetEnabled":false,"gocodeCompletionEnabled":true},"trace":"off","workspaceFolders":[{"uri":"file:///Users/tonyghita/go/src/github.com/org/manyfiles","name":"manyfiles"}]}

[Trace - 12:51:27 PM] Received response 'initialize - (0)' in 28ms.
Params: {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"hoverProvider":true,"completionProvider":{"triggerCharacters":["."]},"signatureHelpProvider":{"triggerCharacters":["(",","]},"definitionProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"codeActionProvider":true,"documentFormattingProvider":true,"renameProvider":true,"documentLinkProvider":{},"typeDefinitionProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"}}},"custom":null}

[Trace - 12:51:27 PM] Sending notification 'initialized'.
Params: {}

[Trace - 12:51:27 PM] Received request 'client/registerCapability - (1)'.
Params: {"registrations":[{"id":"workspace/didChangeConfiguration","method":"workspace/didChangeConfiguration"},{"id":"workspace/didChangeWorkspaceFolders","method":"workspace/didChangeWorkspaceFolders"}]}

[Trace - 12:51:27 PM] Sending response 'client/registerCapability - (1)' in 2ms.
Params: {}

[Trace - 12:51:27 PM] Received request 'workspace/configuration - (2)'.
Params: {"items":[{"scopeUri":"file:///Users/tonyghita/go/src/github.com/org/manyfiles","section":"gopls"}]}

[Trace - 12:51:27 PM] Sending response 'workspace/configuration - (2)' in 6ms.
Params: [{"usePlaceholders":false,"useDeepCompletions":true}]


[Trace - 12:51:27 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"Build info\n----------\nversion v0.1.0-cmd.gopls, built in $GOPATH mode\n\nGo info\n-------\ngo version go1.12.6 darwin/amd64\n\nGOARCH=\"amd64\"\nGOBIN=\"\"\nGOCACHE=\"/Users/tonyghita/Library/Caches/go-build\"\nGOEXE=\"\"\nGOFLAGS=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"darwin\"\nGOOS=\"darwin\"\nGOPATH=\"/Users/tonyghita/go\"\nGOPROXY=\"\"\nGORACE=\"\"\nGOROOT=\"/usr/local/Cellar/go/1.12.6/libexec\"\nGOTMPDIR=\"\"\nGOTOOLDIR=\"/usr/local/Cellar/go/1.12.6/libexec/pkg/tool/darwin_amd64\"\nGCCGO=\"gccgo\"\nCC=\"clang\"\nCXX=\"clang++\"\nCGO_ENABLED=\"1\"\nGOMOD=\"\"\nCGO_CFLAGS=\"-g -O2\"\nCGO_CPPFLAGS=\"\"\nCGO_CXXFLAGS=\"-g -O2\"\nCGO_FFLAGS=\"-g -O2\"\nCGO_LDFLAGS=\"-g -O2\"\nPKG_CONFIG=\"pkg-config\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gv/vdmq3_l541b_0lq_ds37xslnzgdpkw/T/go-build071236191=/tmp/go-build -gno-record-gcc-switches -fno-common\"\n"}

[Trace - 12:51:27 PM] Sending notification 'textDocument/didOpen'.
Params: {"textDocument":{"uri":"file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go:","languageId":"go","version":1,"text":"package manyfiles\n\n[...and so on][Info  - 12:51:27 PM] Build info
----------
version v0.1.0-cmd.gopls, built in $GOPATH mode

Go info
-------
[truncated]

\n\n the rest of the file text..."}

[Trace - 12:51:10 PM] Sending request 'textDocument/documentSymbol - (1)'.
Params: {"textDocument":{"uri":"file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go"}}

[Trace - 12:51:14 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"unable to check package for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go: no packages found for file:///Users/tonyghita/go/src/github.com/org/manyfiles/some_test.go"}

It seems kind of strange that the Go build information is printed in the middle of the file contents in the RPC trace.

@tonyghita
Copy link
Author

@tonyghita tonyghita commented Jun 27, 2019

After updating gopls to 94c5763a7c8445e53114d02cae1060df14079935, I no longer can reproduce this issue. I think one of these commits fixed the issue:

@tonyghita tonyghita closed this Jun 27, 2019
@ollien
Copy link

@ollien ollien commented Jul 7, 2019

I can reproduce this. I have 72ffa07ba3db8d09f5215feec0f89464f3028f8e for gotools

Here is the log from the vscode debug console, both with -rpc-trace and without

Not really sure how to rectify this.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jul 8, 2019

@ollien: Can you open a new issue for this? Your situation likely has a different root cause than the one above.

@golang golang locked and limited conversation to collaborators Jul 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.