go-langserver icon indicating copy to clipboard operation
go-langserver copied to clipboard

Support for go 1.11 / go modules

Open robbyoconnor opened this issue 7 years ago • 17 comments

Things need to be updated to support go 1.11, currently, things don't work correctly in go 1.11.

robbyoconnor avatar Sep 03 '18 06:09 robbyoconnor

Also worth referencing: https://github.com/mdempsky/gocode/issues/46

robbyoconnor avatar Sep 03 '18 23:09 robbyoconnor

I currently have a simple solution

  1. go get -u github.com/visualfc/gocode (it supports go 1.11) and go get -u github.com/visualfc/gotools (needed by visualfc/gocode)
  2. create your project outside fo GOPATH, for example: /home/user/demo
  3. link the project under $GOPATH/src, ln -s /home/user/demo $GOPATH/src/demo

then it works for me now.

doodleEsc avatar Sep 10 '18 11:09 doodleEsc

https://github.com/sourcegraph/go-langserver/pull/305 should ultimately fix the PANIC issue once merged I think

emidoots avatar Sep 11 '18 00:09 emidoots

Hi, I could work on gocode autocomplete support for go 1.11.

  1. gbimporter can probably to be removed since it was used to support gb based projects.
  2. golang.org/x/tools/go/packages needs to be added
  3. go.mod file needs to be added for vendor libraries

@keegancsmith It looks that this change will potentially break go 1.9-1.10 support, which is something I don't like, but I will see how it goes.

The implementation depends on the Go 1.11 go command; support for earlier versions will be added soon.

anjmao avatar Sep 17 '18 12:09 anjmao

Before working on this issue we should probably implement https://github.com/sourcegraph/go-langserver/issues/320.

anjmao avatar Sep 20 '18 09:09 anjmao

not only the code completion, also, find references doesn't work when project is out of gopath.

Tried to dig into this issue, but language server's implementation is too complicated.

imjustfly avatar Sep 29 '18 09:09 imjustfly

I think I find the solution for finding references. Working on it.

imjustfly avatar Sep 30 '18 04:09 imjustfly

#321 makes references and lint available outside the GOPATH.

But in my own opinion, the best direction is rewriting the project with golang.org/x/tools/go/packages, which needs lots of works and is not compatible with older versions of go.

So I concern what's the plan for it ? @keegancsmith

imjustfly avatar Sep 30 '18 11:09 imjustfly

There is a new fork of gocode which works for modules https://github.com/stamblerre/gocode

vscode-go is starting to use it, and it's shown in golang issue trackers for tools supporting modules: https://github.com/golang/go/issues/24661

dzhou121 avatar Oct 12 '18 09:10 dzhou121

Note: The go tools team at Google is working on a language server which will support go/packages from the get go. Here is some more information on that https://go-review.googlesource.com/c/tools/+/136676#message-11c783bc9a9f6adf6119bbb85c89510fda25abe9

Unless someone from the community does this for go-langserver, I suspect the server from google will be ready before we have time to work on this.

keegancsmith avatar Oct 12 '18 12:10 keegancsmith

@robbyoconnor @keegancsmith @dzhou121

bingo is a new go language server that support go 1.11 modules

please try it.

saibing avatar Nov 25 '18 03:11 saibing

Note: The go tools team at Google is working on a language server which will support go/packages from the get go. Here is some more information on that https://go-review.googlesource.com/c/tools/+/136676#message-11c783bc9a9f6adf6119bbb85c89510fda25abe9

Unless someone from the community does this for go-langserver, I suspect the server from google will be ready before we have time to work on this.

Thanks for sharing the link.

So, how does one use the new cmd/golsp?

mbana avatar Feb 04 '19 10:02 mbana

If you are using vscode check out https://github.com/golang/tools/tree/master/cmd/gopls/integration/vscode

keegancsmith avatar Feb 05 '19 07:02 keegancsmith

@keegancsmith Thanks a lot.

I was able to get it working with golsp but I've found bingo to be more stable and faster so I am using bingo. I didn't have to install the extension that you linked to (https://github.com/golang/tools/tree/master/cmd/gopls/integration/vscode). vscode-go worked fine.

I've written a post about setting up the two: https://bana.io/blog/go-language-server/. I've happy to modify the contents of the blog post if you spot issues or have better ideas.

https://github.com/golang/tools/tree/master/cmd/gopls really needs a detailed README.md explaining how to get started and how to contribute. I've spotted a new panics that I know I can fix but looking at repo and it lack of documentation makes me think it's not getting much love, I could be wrong.

mbana avatar Feb 15 '19 10:02 mbana

gopls is under active development by google's go tools team. What I linked to is likely early days, although I believe it is getting close to some sort of announcement. bingo is a good alternative until then.

keegancsmith avatar Feb 18 '19 13:02 keegancsmith

Tried golsp along with its vscode extension. It gave me The gopls server crashed 5 times in the last 3 minutes. The server will not be restarted. error and couldn't figure out why.

@saibing your bingo works nicely. Thanks for the great work!

guiguan avatar Feb 28 '19 02:02 guiguan

golsp worked for me fine...

On 2/27/19 9:35 PM, Guan Gui wrote:

Tried |golsp| along with its |vscode| extension. It gave me |The gopls server crashed 5 times in the last 3 minutes. The server will not be restarted.| error and couldn't figure out why.

@saibing https://github.com/saibing your |bingo| works nicely. Thanks for the great work!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sourcegraph/go-langserver/issues/316#issuecomment-468113019, or mute the thread https://github.com/notifications/unsubscribe-auth/AABaMFqFMASNmHRDK4C8mExv7xtZebVTks5vR0BUgaJpZM4WXCQr.

robbyoconnor avatar Mar 02 '19 00:03 robbyoconnor