@echo off setlocal cd /d "%~dp0" REM Prefer a typical Windows install; do not rely on where.exe (it may be missing from PATH). if exist "%ProgramFiles%\Go\bin\go.exe" set "PATH=%ProgramFiles%\Go\bin;%PATH%" go version >nul 2>nul if errorlevel 1 ( echo Go is not on PATH. Install Go 1.24+ and re-run build.bat. echo If Go is already installed, add its bin directory to PATH and open a new terminal. exit /b 1 ) if not exist dist mkdir dist REM rsrc_windows_amd64.syso embeds Common Controls 6 and the app icon (required by the GUI). REM After changing cmd\tunnel\app.ico or app.manifest, regenerate (see docs\DEVELOPMENT.md): REM go run github.com/akavel/rsrc@latest -manifest cmd\tunnel\app.manifest -ico cmd\tunnel\app.ico -arch amd64 -o cmd\tunnel\rsrc_windows_amd64.syso REM Optional PNG-to-ICO: go run .\tools\mkico REM Keep internal\gui\logo.png in sync with app.ico for tray / in-window icon. set CGO_ENABLED=0 go test ./... if errorlevel 1 exit /b 1 go build -trimpath -ldflags="-s -w" -o dist\mysql-tunnel.exe .\cmd\tunnel if errorlevel 1 exit /b 1 echo Built dist\mysql-tunnel.exe dir dist\mysql-tunnel.exe endlocal