File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ bin /
Original file line number Diff line number Diff line change 1+ $MyScript = $MyInvocation.MyCommand.Definition
2+ $MyPath = Split-Path $MyScript
3+ $MyProject = $ (Get-Item $MyPath ).BaseName
4+
5+ $BuildOpts = @ {
6+ " windows" = @ (" 386" , " amd64" )
7+ }
8+
9+ Push-Location $MyPath
10+ if (! (Test-Path $MyPath \bin)) { New-Item - Path $MyPath \bin - ItemType Directory | Out-Null }
11+
12+ ForEach ($OS in $BuildOpts.GetEnumerator ()) {
13+ ForEach ($Arch in $OS.Value ) {
14+ $env: GOOS = $OS.Key
15+ $env: GOARCH = $Arch
16+
17+ if ($env: GOOS -eq " windows" ) { $Ext = " .exe" } else { $Ext = $null }
18+
19+ Try {
20+ Write-Host " Building: $env: GOOS ($env: GOARCH )"
21+ & go build - o " $MyPath \bin\$MyProject -$env: GOOS -$env: GOARCH$Ext "
22+ }
23+
24+ Catch {
25+ Write-Warning (" Build Failure: $env: GOOS ($env: GOARCH )`r`n`t " + $_.Exception.Message )
26+ }
27+ }
28+ }
29+
30+ Pop-Location
You can’t perform that action at this time.
0 commit comments