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

Support for go 1.11 / go modules #316

Open
robbyoconnor opened this issue Sep 3, 2018 · 17 comments
Open

Support for go 1.11 / go modules #316

robbyoconnor opened this issue Sep 3, 2018 · 17 comments

Comments

@robbyoconnor
Copy link

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

@robbyoconnor
Copy link
Author

Also worth referencing: mdempsky/gocode#46

@doodleEsc
Copy link

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.

@slimsag
Copy link
Member

slimsag commented Sep 11, 2018

#305 should ultimately fix the PANIC issue once merged I think

@anjmao
Copy link
Contributor

anjmao commented Sep 17, 2018

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
Copy link
Contributor

anjmao commented Sep 20, 2018

Before working on this issue we should probably implement #320.

@imjustfly
Copy link
Contributor

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
Copy link
Contributor

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

@imjustfly
Copy link
Contributor

imjustfly commented Sep 30, 2018

#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

@dzhou121
Copy link

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:
golang/go#24661

@keegancsmith
Copy link
Member

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.

@saibing
Copy link

saibing commented Nov 25, 2018

@robbyoconnor @keegancsmith @dzhou121

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

please try it.

@mbana
Copy link
Contributor

mbana commented Feb 4, 2019

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?

@keegancsmith
Copy link
Member

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

@mbana
Copy link
Contributor

mbana commented Feb 15, 2019

@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.

@keegancsmith
Copy link
Member

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.

@guiguan
Copy link

guiguan commented Feb 28, 2019

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!

@robbyoconnor
Copy link
Author

robbyoconnor commented Mar 2, 2019 via email

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

10 participants