-
-
Save goldbattle/aa5d4a158707d4dea62a to your computer and use it in GitHub Desktop.
Install go
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
$cwd = $PSScriptRoot+"\" | |
$gosdk = $cwd+"go" | |
$zip7 = $cwd+"7z" | |
$mingw = $cwd+"mingw64" | |
$gitdir = $cwd+"git" | |
$gopath = $cwd+"gopath" | |
# Install Go | |
if (-Not (Test-Path $gosdk)) { | |
echo "Installing Go into: "$gosdk | |
$file = "go1.5.3.windows-amd64.msi" | |
$url = "https://storage.googleapis.com/golang/" | |
$url += $file | |
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file | |
msiexec INSTALLDIR=$gosdk TARGETDIR=$gosdk /package $file /quiet | Out-Null | |
rm $file | |
} else { | |
echo "Go already installed" | |
} | |
# Install 7Zip | |
if (-Not (Test-Path $zip7)) { | |
echo "Installing 7Zip into: "$zip7 | |
$file = "7z1514-x64.msi" | |
$url = "http://7-zip.org/a/" | |
$url += $file | |
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file | |
msiexec INSTALLDIR=$zip7 TARGETDIR=$zip7 /package $file /quiet | Out-Null | |
rm $file | |
} else { | |
echo "7Zip already installed" | |
} | |
# Install MinGW | |
if (-Not (Test-Path $mingw)) { | |
echo "Installing MinGW into"$mingw | |
$file = "x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z" | |
$url = "https://bintray.com/artifact/download/drewwells/generic/" | |
$url += $file | |
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file | |
&$zip7\7z.exe x $file > $null | |
rm $file | |
} else { | |
echo "MinGW is already installed" | |
} | |
# Install git | |
if (-Not (Test-Path $gitdir)) { | |
echo "Installing git to "$gitdir | |
$file = "Git-2.7.0-64-bit.exe" | |
$url = "https://github.com/git-for-windows/git/releases/download/v2.7.0.windows.1/" | |
$url += $file | |
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file | |
.\Git-2.7.0-64-bit.exe /DIR=$gitdir /SILENT /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh" | Out-Null | |
rm $file | |
} else { | |
echo "git is already installed" | |
} | |
# Check for GOPATH | |
if (-Not (Test-Path $gopath)) { | |
mkdir $gopath | |
} | |
# Ensure environment variables point the way we want them to | |
$env:GOROOT = $gosdk | |
$env:GOPATH = $gopath | |
$env:PATH = $gosdk + "\bin;" + $mingw + "\bin;" + $env:GOPATH + "\bin;" + $gitdir + "\bin;" + $env:PATH | |
echo $env:PATH | |
echo $env:GOPATH | |
go version | |
go env | |
# Download delve | |
go get github.com/tools/godep | |
go get -d github.com/derekparker/delve | |
cd $gopath\src\github.com\derekparker\delve | |
godep restore | |
# Compile delve | |
mingw32-make install | |
cd $cwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment