Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

go-langserver doesn't work when editing a package outside of the gopath #185

Open
keegancsmith opened this issue Apr 18, 2017 · 5 comments
Labels

Comments

@keegancsmith
Copy link
Member

See original issue in vscode-go microsoft/vscode-go#886

@mattoni
Copy link

mattoni commented May 6, 2017

Any updates on this?

@ramya-rao-a
Copy link
Contributor

cc @slimsag

@emidoots
Copy link
Member

@keegancsmith what are your thoughts on this issue? I looked into the referenced issue and I can imagine two scenarios:

  1. Opening a project outside $GOPATH, but having a $GOPATH set.
  2. Opening a project outside $GOPATH, but having no $GOPATH set.

I don't think we can support the latter case feasibly because of our reliance on $GOPATH/pkg now, so I assume this issue is just about supporting case one above.

I tried it out just now on github.com/gorilla/mux outside my $GOPATH, and hover/definition work OK with the godef-based implementation. But find all references and symbol search (#Router in command palette) do not seem to be working correctly.

@keegancsmith
Copy link
Member Author

I think hover/def didn't work before your godef change. Just that working may be sufficient.

The workspace operations won't really work, since in general we need to know the package name a file lives in, and without a GOPATH we don't. However, we can do best effort for */symbol since all that really relies on is parsing the AST. For references I don't think we could reasonably support that without knowing the real package name for a file. Technically we could support references within the same package, but not sure the cost of implementing that is worth it.

@keegancsmith
Copy link
Member Author

A more useful thing we could do is warn the user they are outside a GOPATH, and possibly provide an action to autoconfigure (find /src/ in a parent directory). I think that would have to be done in the extension, rather than in server.

MarkZ3 added a commit to MarkZ3/theia that referenced this issue Aug 28, 2017
This adds support for "go-langserver". At this moment, it is possible
to "Go to definition".

For best results, GOPATH needs to be set, see:
sourcegraph/go-langserver#185

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
MarkZ3 added a commit to eclipse-theia/theia that referenced this issue Aug 29, 2017
This adds support for "go-langserver". At this moment, it is possible
to "Go to definition".

For best results, GOPATH needs to be set, see:
sourcegraph/go-langserver#185

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
kittaakos pushed a commit to eclipse-theia/theia that referenced this issue Sep 1, 2017
This adds support for "go-langserver". At this moment, it is possible
to "Go to definition".

For best results, GOPATH needs to be set, see:
sourcegraph/go-langserver#185

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants