build: 署名注入用单引号包裹,支持含空格的值

This commit is contained in:
AskaEth committed 2026-09-09 20:15:09 +08:00
1 parent 76e725ca96
commit 74e48bf5bc
1 file changed
+2 -1
+2 -1
View File
@@ -35,7 +35,8 @@ REM 文件不存在时二进制里也是空的,源码永远不含真实署名
set "INTERNAL_SIGNATURE=" set "INTERNAL_SIGNATURE="
if exist "..\deploy\signature.local.txt" set /p INTERNAL_SIGNATURE=<"..\deploy\signature.local.txt" if exist "..\deploy\signature.local.txt" set /p INTERNAL_SIGNATURE=<"..\deploy\signature.local.txt"
if defined INTERNAL_SIGNATURE ( if defined INTERNAL_SIGNATURE (
go build -ldflags "-X git.yeij.top/AskaEth/Scoreboard/server/internal/version.InternalSignature=%INTERNAL_SIGNATURE%" -o ..\dist\scoreboard.exe . || exit /b 1 REM 单引号包裹整个 -X:署名里的空格不会被 ldflags 拆开(go 的 ldflags 解析器认单引号)
go build -ldflags "-X 'git.yeij.top/AskaEth/Scoreboard/server/internal/version.InternalSignature=%INTERNAL_SIGNATURE%'" -o ..\dist\scoreboard.exe . || exit /b 1
echo internal signature injected echo internal signature injected
) else ( ) else (
go build -o ..\dist\scoreboard.exe . || exit /b 1 go build -o ..\dist\scoreboard.exe . || exit /b 1