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

Manage tools using go modules

Open mbyio opened this issue 6 years ago • 6 comments

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.

mbyio avatar Aug 16 '19 22:08 mbyio

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:

  • :GoUpdateBinaries and :GoInstallBinaries needs to continue to work so all the tools can be installed updated to avoid delays when the user tries to use a tool that would otherwise not be installed yet.
  • a static go.mod is not required, because vim-go is not a Go module.
  • installing on demand is a nice to have, but not required.

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

bhcleek avatar Aug 16 '19 23:08 bhcleek

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?

mbyio avatar Aug 19 '19 18:08 mbyio

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

bhcleek avatar Aug 19 '19 23:08 bhcleek

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?

arp242 avatar Aug 20 '19 12:08 arp242

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

bhcleek avatar Aug 20 '19 14:08 bhcleek

How do you record which version to use?

arp242 avatar Aug 20 '19 14:08 arp242