48 lines
1.1 KiB
Batchfile
48 lines
1.1 KiB
Batchfile
@echo off
|
||
chcp 65001 >nul
|
||
echo ========================================
|
||
echo 会面点 Meeting Point - Linux 构建
|
||
echo ========================================
|
||
echo.
|
||
|
||
:: 检查 Go 是否安装
|
||
where go >nul 2>nul
|
||
if %ERRORLEVEL% neq 0 (
|
||
echo [错误] 未找到 Go,请先安装 Go 语言环境
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo [1/3] 清理旧构建...
|
||
if not exist "dist" mkdir dist
|
||
|
||
echo [2/3] 编译 Linux (amd64) 可执行文件...
|
||
set CGO_ENABLED=0
|
||
set GOOS=linux
|
||
set GOARCH=amd64
|
||
go build -ldflags="-s -w" -o dist\meeting-point-linux-amd64 .
|
||
|
||
if %ERRORLEVEL% neq 0 (
|
||
echo [错误] 编译失败
|
||
pause
|
||
exit /b 1
|
||
)
|
||
|
||
echo [3/3] 复制配置文件...
|
||
copy config.example.json dist\config.json >nul 2>nul
|
||
|
||
echo.
|
||
echo ========================================
|
||
echo 构建完成!
|
||
echo ========================================
|
||
echo.
|
||
echo 输出文件: dist\meeting-point-linux-amd64
|
||
echo.
|
||
echo Linux 使用方法:
|
||
echo 1. 上传文件到 Linux 服务器
|
||
echo 2. chmod +x meeting-point-linux-amd64
|
||
echo 3. 创建 config.json 配置文件
|
||
echo 4. ./meeting-point-linux-amd64
|
||
echo.
|
||
pause
|