Last active
January 11, 2016 21:04
-
-
Save joerocklin/1b5e21588b6bfed001b6 to your computer and use it in GitHub Desktop.
Setup the current working directory as your GOPATH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the GOPATH directory for this user | |
Write-Output "Setting $pwd as GOPATH user environment variable" | |
[Environment]::SetEnvironmentVariable("GOPATH",$pwd,"User") | |
$Env:GOPATH = $pwd | |
# Update the user's PATH to include the bin directory underneath GOPATH | |
$goBinPath = Join-Path $pwd 'bin' | |
if ($([Environment]::GetEnvironmentVariable("Path","User")).ToLower().Contains($($goBinPath).ToLower()) -eq $false ) { | |
Write-Output "Adding $goBinPath to User Path" | |
[Environment]::SetEnvironmentVariable("Path","$goBinPath;$Env:Path","User") | |
$Env:Path = "$goBinPath;$Env:Path" | |
} else { | |
Write-Output "$pwd is already part of your path" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment