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 object for ident" error after Go to Definition action #32555

Closed
nezorflame opened this issue Jun 11, 2019 · 6 comments
Closed

Comments

@nezorflame
Copy link

@nezorflame nezorflame commented Jun 11, 2019

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

$ go version
go version go1.12.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes (4bfb4c74ac90cc146b53ac8c4f95448c56af4f93).

Seems to have started with the commit golang/tools@596a85b since it's working fine on the one before that.

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

go env Output
$ go env
...
GOOS="darwin"
GOARCH="amd64"

Other setup details

VSCode version: 1.35.0
vscode-go extension version: 0.10.3-beta.5

vscode-go settings
"go.autocompleteUnimportedPackages": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "godoc",
"go.formatTool": "goimports",
"go.lintTool": "golangci-lint",
"go.buildOnSave": "off",
"go.vetOnSave": "off",
"go.lintOnSave": "package",
"go.coverageDecorator": {
    "type": "gutter"
},
"go.coverageOptions": "showUncoveredCodeOnly",
"go.coverOnTestPackage": true,
"go.coverOnSingleTest": false,
"go.testFlags": [
    "-v",
    "-cover"
],
"go.addTags": {
    "tags": "json",
    "promptForTags": false,
    "transform": "snakecase"
},
"go.enableCodeLens": {
    "references": false,
    "runtest": true
},
"go.useLanguageServer": true,
"go.languageServerExperimentalFeatures": {
    "diagnostics": true,
    "documentLink": false,
    "findReferences": true,
},
"gopls": {
    "usePlaceholders": true,
},
"[go]": {
    "editor.defaultFormatter": "ms-vscode.Go",
    "editor.snippetSuggestions": "top",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": true,
    },
},
"files.eol": "\n"

What did you do?

  1. Open VSCode
  2. Open some project
  3. Hover on top of some function or struct (to get documentation)
  4. Use Go to Definition on that piece of code

What did you expect to see?

gopls should direct me to the desired definition

What did you see instead?

Nothing happens, with gopls logging an error:

[Error - 18:12:34] Request textDocument/definition failed.
  Message: no object for ident SomeFunc
  Code: 0

Hovering also gives an error after that:

[Error - 18:15:04] Request textDocument/hover failed.
  Message: no identifier found
  Code: 0 

Overall, gopls seems to stop working completely at this point.

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

@nezorflame nezorflame commented Jun 11, 2019

Also an interesting observation - when this happens, if I try to go to the package which contains the definition for that piece of code (in this case it's a library), I get a lot of spam in the gopls output like this:

[Error - 18:33:54] unable to check package for file:///path/to/my/package/internal/models/orders.go: loadParseTypeCheck: no package found for /path/to/my/package/internal/models/orders.go
[Error - 18:33:54] Request textDocument/codeAction failed.
  Message: no file information for file:///path/to/my/package/internal/models/orders.go
  Code: 0
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 11, 2019

Do the other features work, or is it specifically definition and hover? Do you see any diagnostics for the imported library? Would it be possible to share your full gopls log for your example?

@niktrix
Copy link

@niktrix niktrix commented Jun 11, 2019

gopls logs if it helps, removed file path

[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] Request textDocument/hover failed.
  Message: no AST for file:///
  Code: 0 
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] Request textDocument/definition failed.
  Message: no AST for 
  Code: 0 
[Error - 1:14:43 AM] unable to check package for 
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] Request textDocument/hover failed.
  Message: no AST for file:///
  Code: 0 
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] unable to check package for file:///
[Error - 1:14:43 AM] Request textDocument/hover failed.
  Message: no AST for file:///
@nezorflame
Copy link
Author

@nezorflame nezorflame commented Jun 11, 2019

Hmm. Just tried the new most recent commit (d73e1c7e250b19f9948138e2df37cea712e8f06f) and the problem is gone.
@niktrix mind trying as well?

@niktrix
Copy link

@niktrix niktrix commented Jun 12, 2019

It worked after updating

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jun 12, 2019

Thanks for confirming! Closing this issue.

@stamblerre stamblerre closed this Jun 12, 2019
@golang golang locked and limited conversation to collaborators Jun 11, 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.