vgo integration support

Posted on by

Package management has long been a topic of interest for many people in the Go community. A few months ago, the Go team put forward a new tool, based on the learnings from dep and other package managers. This tool is called vgo, and it’s backed by a new dependency solving algorithm called Minimal Version Selection, or MVS. All of this is described in great detail in Russ Cox’s blog post series.

Given the importance of this tool, it’s easy to see how the request to integrate it with the IDE quickly became one of the most voted features.

Today we are happy to announce the first version this integration is available as a plugin for GoLand 2018.1.2+. This feature will be integrated by default in the upcoming 2018.2 release.



Before you head over to Settings | Plugins | Install JetBrains plugin… and download the vgo support plugin, let’s see what it can do.

To create a project using vgo, you need to select the vgo type in the New Project dialog and then make sure that the IDE detected the vgo location correctly, after that, a new project will be created with the boilerplate go.mod file being created for it.

Now, let’s create a simple web server which will have a dependency. To do so, we’ll use the popular gorilla/mux package, and the following code:



package main import "github.com/gorilla/mux" func main() { r := mux.NewRouter() _ = r }

The IDE will notice that there is no gorilla/mux currently defined in the go.mod file and it will suggest running the required vgo operation to update your dependencies list.

Similarly, if you remove a dependency from the go.mod file, the IDE will automatically remove the dependency from the list of available libraries, all seamlessly integrated into the workflow.

This is an early release of the plugin that we want to share with you. As such, it does have a few of issues of its own, not related to vgo itself.

Perhaps the one that you will first notice is that the IDE won’t allow you to use the vgo list quick fix if the package is already present in the GOPATH. This is a known limitation, and the recommendation is to set your GOPATH to point to somewhere else in the system, vgo still needs it to download and store the package cache. Another way to solve this is to remove the package from your GOPATH, but you will need to also invalidate the IDE cache. Please watch GO-5701 for updates on this issue.

The second issue is that currently the go.mod functionality is minimal, but we have plans to change this, GO-5691.

Another issue is that the “replace” syntax is currently not recognized by the IDE so forks or other sources for the packages will not work, see GO-5702 for more information.

And that’s it for now. Keep in mind that currently vgo is in very early stages and you are likely to encounter some rough edges. If you do so, please report them to us so we can address them or inform the Go team about them.

Please let us know in the comments below or on our issue tracker if you have any suggestions or feedback, or what would you like to see next. And remember, the 2018.2 EAP is right around the corner with a lot of new things to come.