Skip to content

Instantly share code, notes, and snippets.

@hymkor
Created September 29, 2019 07:10
Show Gist options
  • Save hymkor/38fc83655b28c4eaddf002d4c5830cd2 to your computer and use it in GitHub Desktop.
Save hymkor/38fc83655b28c4eaddf002d4c5830cd2 to your computer and use it in GitHub Desktop.
Goの amd64/386 , windows/linux のバイナリパッケージを全部作るバッチファイル
@setlocal
@set "PROMPT=%0> "
@call :"%1"
@endlocal
@exit /b
:""
:"package"
for %%I in (386 amd64) do call :package1 windows %%I .exe
for %%I in (386 amd64) do call :package1 linux %%I
exit /b
:package1
setlocal
set "GOOS=%1"
set "GOARCH=%2"
set "SUFFIX=%3"
for /F %%I in ('cd') do set "NAME=%%~nI"
go build
zip -9m "%NAME%-%GOOS%-%GOARCH%-%DATE:/=%.zip" %NAME%%SUFFIX%
endlocal
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment