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

Allow Go tools to be installed in a separate GOPATH #351

Merged
merged 1 commit into from Jan 12, 2017

Conversation

samherrmann
Copy link
Contributor

This is a prototype for issue #5.

The approach used in this prototype allows users to install the Go tools in a separate GOPATH by setting a VSCODE_GOTOOLS env variable to the directory of where they want to install the tools.

  1. What do you think of the overall approach?
  2. Is VSCODE_GOTOOLS a good name for the env variable?

@samherrmann
Copy link
Contributor Author

samherrmann commented Jun 6, 2016

hmm right after I created the pull request, I went back to the issue thread and realized that I should have probably used the bin lookup instead of appending the tools path to the GOPATH.

@samherrmann samherrmann force-pushed the tools-gopath branch 3 times, most recently from c6b39ab to 158949d Compare June 6, 2016 03:48
@lukehoban
Copy link
Contributor

This is great - I'm actually pleasantly surprised that it's this simple to add support for a separate Go tools installation path.

I think eventually it would be good to expand upon this and choose a default location for the tools and automatically download them for the user on startup, as well as tracking/managing versions, to avoid all of the current manual acquisition steps.

But this feels like a reasonable step toward that which enables users to easily setup their own global installation path, and allows us to go further in the future, but also to offer configurability of the installation location in the future even if the default changes.

On the env var name - I'm happy with VSCODE_GOTOOLS.

/cc @ironcladlou in case he has any thoughts on this.

@ramya-rao-a
Copy link
Contributor

@samherrmann There has been quite a few changes to goPath.ts and goInstallTools.ts files since this PR. Can you resend this PR, after getting the latest from master?

@samherrmann
Copy link
Contributor Author

Yup, I will try to do this tonight.

@ramya-rao-a ramya-rao-a merged commit 5a3273c into microsoft:master Jan 12, 2017
@ramya-rao-a
Copy link
Contributor

Thanks @samherrmann !

@ahmetb
Copy link

ahmetb commented Jan 13, 2017

@samherrmann @ramya-rao-a Is there a reason why this is implemented as an environment variable and not a configuration key in user's vscode profile? The way I see it, people run vscode as code . from the terminal and you can't expect them to have this ENV key set at all times. (I certainly do not wish to be in that business.)

I think a config key would be a "less ephemeral" solution and would preserve between launches. For instance, I manually install all go tools to my ~/gotools folder, I wish I could just set it to a vscode preference key and forget about it forever and vscode would handle things for me (such as perhaps periodically updating these tools).

@ironcladlou
Copy link
Contributor

ironcladlou commented Jan 13, 2017 via email

@samherrmann
Copy link
Contributor Author

Yes I think I agree as well. I think I used an env var because it seemed to make sense when looking at the existing code, but from a user's point of view a config key makes probably more sense.

Here is my first attempt at implementing the change:
samherrmann@18829b5

Please provide feedback if anything already jumps out at you.

@ramya-rao-a
Copy link
Contributor

One catch with setting this as a user/workspace setting is that the debug adapter will not be able to read it, and so this will work for all tools except dlv

mattetti added a commit to mattetti/vscode-go that referenced this pull request Jan 16, 2017
…ild-i

* 'master' of github.com:Microsoft/vscode-go:
  Moved debugging doc to a separate wiki
  Make a copy of process.env when setting VSCODE_GOTOOLS
  Debugger cannot read settings
  Improve error handling of test coverage (microsoft#721)
  Use proper plurality in output (microsoft#720)
  Fixes microsoft#303 Dont run test if current file is  not test file
  Added a note on how to debug single tests
  Allow Go tools to be installed in a separate GOPATH (microsoft#351)
  Fix typo in README.md (microsoft#715)
  Honor the 'cwd' launch configuration argument (microsoft#714)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants