Building the Binary
Development vs Production Builds (-tags prod)
Development Build
bash
go build -o goforge ./appIncludes the loader command (core/console/db_loader.go, guarded by //go:build !prod) used by atlas.hcl.
Production Build
bash
CGO_ENABLED=1 go build -tags prod -ldflags="-s -w" -o goforge ./app-tags prodexcludesloaderandariga.io/atlas-provider-gorm, keeping the production binary smaller.-ldflags="-s -w"strips symbol tables and DWARF debug info.
CGO vs Pure-Go Static Builds
- With SQLite (
mattn/go-sqlite3):CGO_ENABLED=1and a C compiler (gcc/musl-dev) are required. - Without SQLite (PostgreSQL / MySQL / SQL Server): if you selected only pure-Go drivers in
goforge new(or removedcore/database/drivers/sqlite.go), you can build completely static binaries:bashCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags prod -ldflags="-s -w" -o goforge ./app
Live Reload (air.toml)
air.toml watches .go, .tpl, .tmpl, and .html files (excluding _test.go, assets, tmp, vendor), builds ./app to tmp/main, and sends SIGINT with a 500ms kill delay for clean graceful shutdown:
bash
air -c air.toml