Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Go modules #1906

Closed
3 of 4 tasks
bhcleek opened this issue Aug 6, 2018 · 15 comments
Closed
3 of 4 tasks

Support Go modules #1906

bhcleek opened this issue Aug 6, 2018 · 15 comments

Comments

@bhcleek
Copy link
Collaborator

bhcleek commented Aug 6, 2018

To support Go 1.11 fully, vim-go changes need to be made to handle module mode development.

Obviously, vim-go will be dependent on a number of tools getting updated to complete the support, but there are a number of changes that will need to be made to vim-go itself.

@aofei
Copy link
Contributor

aofei commented Aug 26, 2018

+1

But I think this plugin is hard to support the Go modules, at least not until golang/go#24661 is fixed.

@AdamSLevy
Copy link

At minimum things like syntax highlighting can be added for the go.mod and go.sum files.

fatih added a commit that referenced this issue Aug 30, 2018
This adds initial support for the `go.mod` file.  It adds the
followings:

* Syntax highligthing. We highlight keywords, strings, operator and
semver version. It works pretty well for now.
* Auto fmt on save. Command `:GoModFmt` or `Plug(go-mod-fmt)` for custom
  mappings

Before we fully support the semantics of go.mod, I think this initially
will be helpful because I discovered that `go.mod` is read and edited a
lot. So going forward, this will make it easier experimenting with Go
modules.

related: #1906
@fatih fatih mentioned this issue Aug 30, 2018
3 tasks
@fatih
Copy link
Owner

fatih commented Aug 30, 2018

Added initial support for :GoModFmt (auto format the go.mod file) and syntax highlighting here: #1931

fatih added a commit that referenced this issue Aug 30, 2018
This adds initial support for the `go.mod` file.  It adds the
followings:

* Syntax highligthing. We highlight keywords, strings, operator and
semver version. It works pretty well for now.
* Auto fmt on save. Command `:GoModFmt` or `Plug(go-mod-fmt)` for custom
  mappings

Before we fully support the semantics of go.mod, I think this initially
will be helpful because I discovered that `go.mod` is read and edited a
lot. So going forward, this will make it easier experimenting with Go
modules.

related: #1906
@rkuska
Copy link

rkuska commented Sep 3, 2018

Is it expected that things like auto fmt (and go imports) on save doesn't work outside of GOPATH?

@fatih
Copy link
Owner

fatih commented Sep 3, 2018

@rkuska no, gofmt works on a single file and should work outside GOPATH.

@rkuska
Copy link

rkuska commented Sep 3, 2018

Sorry for the noise, I had let g:go_fmt_fail_silently = 1 and there was syntax error in my file 🤦‍♂️ but when I cd-ed to my original GOPATH location the syntax error wasn't there and go fmt was working so I assumed the above.

@makkes
Copy link

makkes commented Oct 23, 2018

:GoDoc also doesn't seem to work with modules.

@bhcleek bhcleek added this to the vim-go 1.20 milestone Nov 4, 2018
@powerman
Copy link
Contributor

:GoDoc also doesn't seem to work with modules.

It's not because of modules, it's just Go 1.11 removed this functionality from godoc. Looks like we should use go doc instead, but it show less information when viewing doc about whole package and thus require request per each single function/method, which means we need very good navigation to make it fast and easier to move between these small chunks of doc. Also I didn't found a way to move from doc to source with go doc. Maybe distributing old godoc binary with vim-go will solve these issues, but it's unclear if old godoc is compatible with modules (unlikely).

@thepudds
Copy link

thepudds commented Feb 16, 2019

Some related discussion in PR #1988, including #1988 (comment) and #1988 (comment)

Also some discussion in #2137, including:

I just found the hint that GoUpdateBinaries might could help and it works now for me.

@urandom2
Copy link

it looks like there are some issues with the current go.mod syntax highlighting processing pre-release identifiers, want me to fork off a new issue:
2019-03-21-082142_376x134_scrot

@bhcleek
Copy link
Collaborator Author

bhcleek commented Apr 21, 2019

vim-go has good support from modules now. I'm closing this; any remaining gaps should be filed as separate issues.

@bhcleek bhcleek closed this as completed Apr 21, 2019
@thepudds
Copy link

@bhcleek This is great!

Is there a thought around publishing a new official release? Most recent official release was November, I think.

@thepudds
Copy link

And... looks like I should have waited slightly longer prior to asking about a new release... ;-)

https://github.com/fatih/vim-go/releases/tag/v1.20

@sdeoras
Copy link

sdeoras commented Jul 20, 2019

Hi Folks, How can I make vim-go based code completion in a go-module use vendor folder in that module? Any pointers on how to set it up correctly is appreciated.

Also I hit following error for a project (it is a large project/module with over 100MB of source in multiple packages). Code completion and navigation works as expected for other smaller projects. Is this setting configurable?
source languageserver.golang timeout after 2000ms

@pedromss
Copy link

Sorry to ask in a closed issue but my GoBuild isn't using the GO111MODULE=on. Is there something else I need to do to build with module?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests