1棚放、Windows版的打包
創(chuàng)建一個文件 go_build.txt
寫入內(nèi)容
::刪除release文件夾
rd /s/q release
::創(chuàng)建release文件夾
md release
::去掉啟動時的黑框
go build -ldflags "-H windowsgui" -o go_build.exe
::構(gòu)建
::go build -o go_build.exe
COPY go_build.exe release\
COPY favicon.ico release\favicon.ico
::將靜態(tài)頁面及樣式拷貝帶release
XCOPY asset\*.* release\asset\ /s /e
XCOPY view\*.* release\view\ /s /e
將go_build.txt更名為go_build.bat,放入main.go同等目錄中執(zhí)行即可
2禁舷、Linux打包
創(chuàng)建一個sh文件 go_build.sh
寫入內(nèi)容
#!/bin/sh
rm -rf ./release
mkdir release
go build -o go_build
chmod +x ./go_build
cp go_build ./release/
cp favicon.ico ./release/
cp -ar ./asset ./release/
cp -ar ./view ./release/
sh go_build.sh 執(zhí)行即可