You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
837 B
Batchfile
46 lines
837 B
Batchfile
@echo off
|
|
setlocal
|
|
|
|
:: Check if Go is installed
|
|
where go >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo [ERROR] Go is not installed. Please install Go first.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:: Show Go version
|
|
for /f "tokens=3" %%i in ('go version') do echo Go version: %%i
|
|
|
|
:: Change to script directory
|
|
cd /d "%~dp0"
|
|
|
|
:: Set target platform
|
|
set GOOS=windows
|
|
set GOARCH=amd64
|
|
set CGO_ENABLED=0
|
|
|
|
echo Target: %GOOS%/%GOARCH%
|
|
echo Output: tcp_service.exe
|
|
echo.
|
|
|
|
:: Build
|
|
echo Building...
|
|
go build -ldflags="-s -w" -o tcp_service.exe main.go
|
|
|
|
if %errorlevel% equ 0 (
|
|
echo.
|
|
echo ============================
|
|
echo Build SUCCESS!
|
|
echo Output: tcp_service.exe
|
|
echo ============================
|
|
) else (
|
|
echo.
|
|
echo ============================
|
|
echo Build FAILED!
|
|
echo ============================
|
|
)
|
|
|
|
echo.
|
|
pause
|