Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Support variable substitution for go.path setting #343

Closed
osechet opened this issue May 28, 2016 · 4 comments
Closed

Support variable substitution for go.path setting #343

osechet opened this issue May 28, 2016 · 4 comments

Comments

@osechet
Copy link

osechet commented May 28, 2016

It would be nice if environment variable substitution was possible with the go.path setting. I use a separate workspace for each of my go projects and I append the current project path to the GOPATH variable. That way I keep the shared tools (gofmt, golint...) together and I don't have to download them for each project.
With the go.path setting I can configure vscode to work this way, however I have to "hard code" my path:
"go.gopath": "C:/devel/go;${workspaceRoot}"
where C:/devel/go is my GOPATH.

I would like to be able to set it as follow:
"go.gopath": "${env.GOPATH};${workspaceRoot}"

@lukehoban
Copy link
Contributor

I would like to be able to set it as follow: "go.gopath": "${env.GOPATH};${workspaceRoot}"

This is something that VS Code would need to support - I believe microsoft/vscode#2809 is tracking this, and microsoft/vscode#3759 was another similar report related to vscode-go.

That way I keep the shared tools (gofmt, golint...) together and I don't have to download them for each project.

FWIW - Addressing that particular issue without forcing you to use a dual GOPATH is what #5 has been tracking.

@osechet
Copy link
Author

osechet commented May 29, 2016

This is something that VS Code would need to support

Yes, I agree, it would be better if it was supported by vscode natively. However, this extension is already doing it for $workspaceRoot (here) so why not for environment variables? I saw all the issues you are refering to, but all of them have been closed or postponed.

About #5, I don't think managing the go tools in a specific way to the IDE is a good idea. What if I want to use another editor/IDE? Should the go tools be duplicated for each IDE I use? I think it's best to work as suggested by golang and with the solutions provided by golang. Multiple GOPATH is such a solution: one path for all the shared tools and dependencies, another one for the current project, then the vendor directory for the specific dependencies.

@osechet
Copy link
Author

osechet commented May 29, 2016

I already implemented this in my own repo. I can create a pull request if you are interested.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
@ramya-rao-a
Copy link
Contributor

This feature is now available in the latest update to the Go extension (0.7.0)
Thanks to @sphawk!

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

No branches or pull requests

3 participants