-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-compile-go.ps1
More file actions
executable file
·45 lines (35 loc) · 1.12 KB
/
build-compile-go.ps1
File metadata and controls
executable file
·45 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#requires -module Corkscrew
[Cmdletbinding()]
Param (
)
switch -Regex (Get-OsVersion) {
'Windows' {
$PathSeparator = ';'
}
'MacOSX' {
if (-not (Test-Path -Path $env:GOROOT)) {
$env:GOROOT = "/usr/local/opt/go/libexec"
}
$PathSeparator = ':'
}
}
$env:GOPATH = Join-Path -Path (Resolve-Path -Path ./) -ChildPath "go"
$env:PATH = $env:PATH + $PathSeparator + (Join-Path -Path $env:GOPATH -ChildPath 'bin')
$env:PATH = $env:PATH + $PathSeparator + (Join-Path -Path $env:GOROOT -ChildPath 'bin')
$OutputPath = Join-Path -Path (Resolve-Path -Path ./) -ChildPath "Gossh/Bin"
Push-Location -Path $env:GOPATH
Write-Verbose "Getting go dependencies"
# load go dependencies
go get "github.com/zepryspet/GoPAN/utils"
go get "golang.org/x/crypto/ssh"
go get "github.com/sfreiberg/simplessh"
Write-Debug "dependencies loaded, continuing to build"
Write-Verbose "Building for macos"
$env:GOARCH = 'amd64'
$env:GOOS = 'darwin'
go build -o "$OutputPath/gossh"
Write-Verbose "Building for windows"
$env:GOARCH = 'amd64'
$env:GOOS = 'windows'
go build -o "$OutputPath/gossh.exe"
Pop-Location