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 CheckPackageHandles for file #35081

Closed
kevinburke1 opened this issue Oct 22, 2019 · 14 comments
Closed

x/tools/cmd/gopls: no CheckPackageHandles for file #35081

kevinburke1 opened this issue Oct 22, 2019 · 14 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@kevinburke1
Copy link

  1. Compile Go at tip (51504f0)
  2. Compile x/tools at tip (0bb5a05). My x/tools lives in $GOPATH/src/golang.org/x/tools but I compiled by running GO111MODULE=on go install -v ./....
  3. Download github.com/jmhodges/justrun to $GOPATH/src/github.com/jmhodges/justrun
  4. Open watch.go in vim and call :GoDef while the cursor is on NewWatcher.

If I have GO111MODULE=on for step 4 I get the definition, as expected - if it is off, I get "no CheckPackageHandles for file /path/to/watch.go."

I am also having trouble figuring out how to export logs, I can start vim-go with these settings:

let g:go_debug = ['lsp']
let g:go_debug_log_output = 'debugger,rpc'

but the window at the bottom with gopls log messages scrolls off of the right edge of my screen, and it's not clear if they are also being written to a log file somewhere.

@gopherbot gopherbot added this to the Unreleased milestone Oct 22, 2019
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Oct 22, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@kevinburke1
Copy link
Author

Following the troubleshooting guide:

For instance, :GoReportGitHubIssue in vim-go.

Running that command yields:

E492: Not an editor command: GoReportGithubIssue

@kevinburke1
Copy link
Author

Oh, ugh, I typed it as GoReportGithubIssue the first time.

@kevinburke1
Copy link
Author

kevinburke1 commented Oct 22, 2019

#### vim-go configuration:
<details><summary>vim-go configuration</summary><br><pre>
g:go_list_type = 'quickfix'
g:go_fmt_autosave = 1
g:go_debug = ['lsp']
g:go_debug_log_output = 'debugger,rpc'
g:go_test_timeout = '2s'
g:go_fmt_command = 'goimports'
g:go_jump_to_error = 1
g:go_loaded_gosnippets = 1
g:go_loaded_install = 1

@stamblerre
Copy link
Contributor

Can you share the output of gopls -rpc.trace -v check path/to/watch.go?

@kevinburke1
Copy link
Author

@kevinburke1
Copy link
Author

I'm realizing now that $GOPATH/src/github.com/fsnotify/fsnotify doesn't exist. I didn't previously notice this because I usually run justrun in projects that have vendored all dependencies.

Still, it seems like we could present a better error message here besides "no CheckPackageHandles."

@stamblerre
Copy link
Contributor

Did that error message come up when you tried to go to the definition of the unknown variable?

@kevinburke1
Copy link
Author

Yes - when I hovered over "NewWatcher" in watch.go and hit :GoDef in vim

@stamblerre
Copy link
Contributor

stamblerre commented Oct 22, 2019

Did it say "no CheckPackageHandles" for the nonexistent package or for the original package?

@kevinburke1
Copy link
Author

kevinburke1 commented Oct 22, 2019

The original package, justrun/watch.go. Here's what's in the vim log:

received: Content-Length: 327^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 18.838018ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=off PWD=/Users/kevin/src/github.com/jmhodges/justrun go \"env\
  8 received: Content-Length: 129256^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 129.449606ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=off PWD=/Users/kevin/src/github.com/jmhodges/justrun go \"
  7 received: Content-Length: 131^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackages = 2"}}¬
  6 received: Content-Length: 391^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackage = github.com/jmhodges/justrun\n\tfiles = [/Users/kevin/src/github.com/jmhodges/justrun/cmdwrap.go /Users/
  5 received: Content-Length: 452^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackage = github.com/jmhodges/justrun\n\tfiles = [/Users/kevin/src/github.com/jmhodges/justrun/cmdwrap.go /Users/
  4 received: Content-Length: 129256^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 132.234713ms for GOROOT=/Users/kevin/go GOPATH=/Users/kevin GO111MODULE=off PWD=/Users/kevin/src/github.com/jmhodges/justrun go \"
  3 received: Content-Length: 131^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackages = 2"}}¬
  2 received: Content-Length: 391^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackage = github.com/jmhodges/justrun\n\tfiles = [/Users/kevin/src/github.com/jmhodges/justrun/cmdwrap.go /Users/
  1 received: Content-Length: 452^M^@^M^@{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"2019/10/22 13:21:21 go/packages.Load\n\tpackage = github.com/jmhodges/justrun\n\tfiles = [/Users/kevin/src/github.com/jmhodges/justrun/cmdwrap.go /Users/
  0 received: Content-Length: 155^M^@^M^@{"jsonrpc":"2.0","error":{"code":0,"message":"no CheckPackageHandles for file:///Users/kevin/src/github.com/jmhodges/justrun/watch.go","data":null},"id":2}¬

@stamblerre
Copy link
Contributor

Ok, so I'm thinking that this sounds very similar to #34012, in that an import failing to resolve causes all language features to fail. I will then close this as a duplicate.

@stamblerre
Copy link
Contributor

Duplicate of #34012

@stamblerre stamblerre marked this as a duplicate of #34012 Oct 22, 2019
@kevinburke1
Copy link
Author

OK, thank you for investigating.

@golang golang locked and limited conversation to collaborators Oct 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants