-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.bat
39 lines (31 loc) · 842 Bytes
/
build.bat
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
@echo off
SET GOOS=windows
SET GOARCH=amd64
SET filename=GoInterruptPolicy
:loop
CLS
gocritic check -enableAll -disable="#experimental,#opinionated,#commentedOutCode" ./...
IF exist %filename%.exe (
FOR /F "usebackq" %%A IN ('%filename%.exe') DO SET /A beforeSize=%%~zA
) ELSE (
SET /A beforeSize=0
)
: Build https://golang.org/cmd/go/
go build -tags debug -buildvcs=false -o %filename%_debug.exe
go build -ldflags="-w -s -H windowsgui" -o %filename%.exe
FOR /F "usebackq" %%A IN ('%filename%.exe') DO SET /A size=%%~zA
SET /A diffSize = %size% - %beforeSize%
SET /A size=(%size%/1024)+1
IF %diffSize% EQU 0 (
ECHO %size% kb
) ELSE (
IF %diffSize% GTR 0 (
ECHO %size% kb [+%diffSize% b]
) ELSE (
ECHO %size% kb [%diffSize% b]
)
)
: Run
@REM IF %ERRORLEVEL% EQU 0 %filename%.exe
PAUSE
GOTO loop