Skip to content

Building the Binary ​


Development vs Production Builds (-tags prod) ​

Development Build ​

bash
go build -o goforge ./app

Includes 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 prod excludes loader and ariga.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=1 and 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 removed core/database/drivers/sqlite.go), you can build completely static binaries:
    bash
    CGO_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

Released under the Apache-2.0 License.