fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16.01k stars 1.45k forks source link

Manage tools using go modules #2456

Open mbyio opened 5 years ago

mbyio commented 5 years ago

I wasn't sure if the issue template was appropriate for this. Filled it out anyway. This is a feature request - it would be nice if vim-go used go modules to manage the integrated tools. That way, it can use its own, consistent versions (or users can specify their own versions), and go will take care of keeping everything organized. People wouldn't have to run :GoInstallBinaries or :GoUpdateBinaries anymore either, because Go would download the right ones automatically when they are asked for. I can help implement if it sounds interesting.

bhcleek commented 5 years ago

You're exactly right, and I have a local branch where I'm working on exactly this using a proof of concept that we worked out last year. It turns out that you don't even actually need Go modules (e.g. in a go.mod) for this. Here's my acceptance criteria if you want to work on it:

We actually have most of the code, but just need to organize it and make sure it works as expected.

mbyio commented 5 years ago

Cool! I figured someone else had already thought of doing this. My plate is full currently, but I may have time next week. Is the existing code in a branch somewhere?

bhcleek commented 5 years ago

The code is in a stash on my local branch; it's not ready to be pushed any place yet.

arp242 commented 5 years ago

Note this already exists in the form of gopher.vim. It works pretty well. Most of the code for it is in autoload/gopher/system.vim.

a static go.mod is not required, because vim-go is not a Go module.

The advantage of adding a go.mod is that you can use all the regular Go tooling. Want to update stuff? go get -u, want to use a local copy? replace original => /path/to/replacement, etc. etc. I'm not sure how else to do it without reinventing the wheel on all of this?

bhcleek commented 5 years ago

go.mod isn't needed at all, because go get will do just fine in module mode.

arp242 commented 5 years ago

How do you record which version to use?