beads/.buildflags
matt wilkie 2ade22e84c
chore(build): codify the gms_pure_go build-tag policy (GH#3303)
Converges the sprinkle of -tags=gms_pure_go fixes into a single source plus a source-time CI guard. .buildflags is now canonical (exports GOFLAGS, CGO_ENABLED), scripts source it, scripts/check-build-tags.sh runs in CI to catch bare go commands. Fixes 5 latent bugs the guard caught (regression.yml, Makefile bench/test-regression, devcontainer, embedded-test-shard fallback, smoke-test scripts).
2026-04-16 12:28:11 -07:00

24 lines
1.1 KiB
Text

# Canonical build flags for beads. Source this in any script that invokes
# `go` to get the project-wide build settings. Scripts that intentionally
# exercise the ICU path (e.g. scripts/test-cgo.sh) do NOT source this.
#
# Rationale: go-mysql-server links ICU by default under cgo. beads never
# uses SQL REGEXP, so we always build with -tags=gms_pure_go. See
# docs/ICU-POLICY.md for the full policy.
# Embedded Dolt requires CGO; server mode and nocgo builds do not. Default
# to 1 for the embedded-capable build paths that sourced this, but respect
# a caller who explicitly set CGO_ENABLED=0 (e.g. a static/nocgo build).
: "${CGO_ENABLED:=1}"
export CGO_ENABLED
# Build tag that tells go-mysql-server to use Go's stdlib regex instead of
# the ICU-backed go-icu-regex. Exported so callers can compose with extra
# tags: `go test -tags=regression,$BEADS_BUILD_TAGS ...`
export BEADS_BUILD_TAGS="gms_pure_go"
# Propagate the tag via GOFLAGS so every subsequent bare `go` invocation
# picks it up automatically. Idempotent: re-sourcing is a no-op.
if [[ "${GOFLAGS:-}" != *gms_pure_go* ]]; then
export GOFLAGS="${GOFLAGS:+$GOFLAGS }-tags=${BEADS_BUILD_TAGS}"
fi