Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

go to definition delay && doesn't work on some third-party packages #2222

Closed
sunliver opened this issue Dec 30, 2018 · 3 comments
Closed

go to definition delay && doesn't work on some third-party packages #2222

sunliver opened this issue Dec 30, 2018 · 3 comments

Comments

@sunliver
Copy link

Example code and some tests:

https://github.com/sunliver/mod-test

After tested some third-party packages, I've found some third-party packages fail to go to definition(github.com/spf13/cobra), and some work very slow (github.com/spf13/viper). Results can be seen in my repo.

As the readme says,

  1. when you are outside the mod directory (for example, workspace dir), godef will fail on some cases
  2. godef works much slower than expected

Reason:

Current vscode-go extension misused the new godef, now always run godef on workspace dir.
Because new godef relays on packages to find definitions.
A quick example for verifying this => gopackages

So the new godef working with go mod, it should run inside the mod project, otherwise it will fallback to the old version.

├── gomod-test   => workspace dir
│   └── mod-test    => mod root
│       ├── Readme.md
│       ├── go.mod
│       ├── go.sum
│       ├── mod-test.go
│       └── modinner

How to fix

I've fixed this on this PR, or may other ways.

@mhr3
Copy link
Contributor

mhr3 commented Jan 6, 2019

Looks like this is related to #2180 and #2194

@ramya-rao-a
Copy link
Contributor

@sunliver Can you try the latest beta version of this extension?

@sunliver
Copy link
Author

@ramya-rao-a
Thank you! It works now.

@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants