-
Notifications
You must be signed in to change notification settings - Fork 646
Should Go tools be installed to a separate GOPATH from what user has set? #5
Comments
I prefer that they are installed to the current GOPATH. I also prefer that that the tool executables are looked up from the PATH, not from GOROOT or GOPATH. |
i wouldn't mind it in it's own private section as long as it is easy to navigate too / find from a options menu or a button in a dialog somewhere, in case you want to do something regarding the tools. |
Here are what I see as some compelling benefits to installing the tooling to an isolated plugin GOPATH:
The ability to pin a project's tools to a certain Git tag is useful for the case where you're trying to approximate a custom build environment locally in your IDE. For example, One problem that may not be easily solved is FWIW, in GoTools, I use a precedence based lookup to find support binaries (GOPATH > PATH > GOROOT). |
@ironcladlou Thanks - this a good list of reasons to do this, and I'm increasingly inclined to think it's the right direction to go in the future. Regarding lookup precedence, that same order is what is being used currently in https://github.com/Microsoft/vscode-go/blob/master/src/goPath.ts#L12-L46 |
Just a note from the peanut gallery: having multiple GOPATHs, per-project or otherwise, is nonstandard, and will become increasingly rare as GO15VENDOREXPERIMENT becomes the defacto standard for dependency management. |
I'm curious to understand this statement better. Multi-element GOPATH is explicitly supported as part of the handling of GOPATH since at least 1.4, and isolating project builds using project-scoped GOPATH is a totally idiomatic in the ecosystem.
I admire your optimism... 😁 |
Yes, that's true. (Even before then, IIRC.) The intent was to allow a two-tier GOPATH hierarchy, e.g.
The go tooling, e.g. go get, would always write to the first path, which could be interpreted as "not my code", and you could keep your code in the second path, to allow a kind of simple hermetic separation. But not many folks ever used it. And it's much less important now that we have the vendor/ standard for third-party code.
Sorry, that's not true. [edit: I guess I should be more precise and say I don't agree :)] — It's definitely possible, but repos and projects which represent their own GOPATH are and have always been nonidiomatic, as they're incompatible with |
@ramya-rao-a can we please close this issue. Between Go not encouraging this approach and the support for vendoring, I think it's fine to close this old issue. |
@lukehoban @ironcladlou Do you have any more thoughts on this thread? There is a PR open as well. I don't have much history here, so will leave it up to @lukehoban to take a call. |
I actually think the PR in #351 is a good solution to this which doesn't change the default experience but allows folks who do want to isolate their tools into a separate GOPATH to do that. I think this is orthogonal to multi-part GOPATH and vendoring concerns. This is just about where to store the binaries for the tools - and it's nice to have the option to place them somewhere outside of the active GOPATH. |
As long as the default location doesn't change I am fine. Not understanding why doing a go get -u on a tool doesn't update the version used in VSCode is problematic. |
That's not true. |
Sorry for the confusing message, that's exactly what I meant. Whoever will choose 2 go bin locations will find itself in this scenario |
I personally still use separate GOPATHs per project (although thankfully no longer use multi-element GOPATH entries with the widespread adoption of 1.5+ vendoring), and so have a need (and already use) a "global" GOPATH that contains my tooling binaries. So, I handle tool updates manually. The solution in #351 would work for me. |
Ok then, I have pinged @samherrmann to resend the said PR after resolving merge conflicts. After that we should be good to go |
PR is merged. This will be out in the next update. Thanks everyone! |
I was testing this feature of using the env var as a separate location for the Go tools. This doesn't work for If |
Hello All, The latest update (0.6.53) gives the user an option to install the go tools to an alternate location. This is done via the new setting Remember to run Note: Please give it a try and comment here (or open a new issue) if you see any issues. |
Currently, Go tools are located and acquired based on the currently active GOPATH. This has a few downsides:
Instead, the plugin could automatically install these to it's own private GOPATH and use the binaries from that location. This could also allow the plugin to control versioning of these tools more precisely.
Additional feedback from offline discussion:
Thoughts?
The text was updated successfully, but these errors were encountered: