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

Go to definition don't work when doing "dot" import #856

Closed
charlires opened this issue Mar 10, 2017 · 9 comments
Closed

Go to definition don't work when doing "dot" import #856

charlires opened this issue Mar 10, 2017 · 9 comments

Comments

@charlires
Copy link

When using dot import, go to definition of a function doesn't work

e.i.

import "github.com/user/pkg"
pkg.Foo() // Works
import . "github.com/user/pkg"
Foo() // Fails

Hope this is enough explanation, I'll add more if needed.

@ramya-rao-a
Copy link
Contributor

Please see #496 which is tracking the exact same issue

@ramya-rao-a
Copy link
Contributor

By default, godef is used by the Go extension to provide Go to Definition feature which doesn't work with dot imports.

Add to your settings "go.docsTool": "gogetdoc" to use gogetdoc instead or "go.useLanguageServer": true to use the new experimental language server feature

@charlires
Copy link
Author

Thank you @ramya-rao-a

@paulcalcraft
Copy link

paulcalcraft commented Oct 2, 2017

Thanks @ramya-rao-a, "go.docsTool": "gogetdoc" works great after installing gogetdoc by running:
go get github.com/zmb3/gogetdoc

Go to definition was failing silently with this setting before I realised I needed to manually install gogetdoc.

@ramya-rao-a
Copy link
Contributor

@paulcalcraft Yes, I noticed the failing silently part recently and fixed with 2e56371

Will be releasing an update soon

@unix2dos
Copy link

@ramya-rao-a in 1.92 mac ,Go to definition was failing silently. Where did I go wrong? Thanks

@ramya-rao-a
Copy link
Contributor

@unix2dos Are you seeing the Go to definition feature failing only for dot imports or for all cases?

@unix2dos
Copy link

@ramya-rao-a Go to definition feature failing only for dot imports. other cases are ok.
my config and install them all

    "go.useLanguageServer": true,
    "go.docsTool": "gogetdoc",

@ramya-rao-a
Copy link
Contributor

@unix2dos You are using the language server which doesnt give the definition for dot imports. I have logged sourcegraph/go-langserver#227

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
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

4 participants