* fix(release): prevent non-CGO bd binaries from shipping * fix: make verify-cgo.sh executable GoReleaser invokes this as ./scripts/verify-cgo.sh which requires +x. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: beads/crew/collins <steve.yegge@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
739 B
Bash
Executable file
30 lines
739 B
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# verify-cgo.sh - Fail if a built binary reports CGO_ENABLED=0.
|
|
# Usage: ./scripts/verify-cgo.sh <path-to-binary>
|
|
|
|
set -euo pipefail
|
|
|
|
if [[ $# -ne 1 ]]; then
|
|
echo "Usage: $0 <path-to-binary>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
binary_path="$1"
|
|
|
|
if [[ ! -f "$binary_path" ]]; then
|
|
echo "ERROR: binary not found: $binary_path" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v strings >/dev/null 2>&1; then
|
|
echo "ERROR: 'strings' is required to verify CGO metadata" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if strings "$binary_path" | awk '/^build[[:space:]]+CGO_ENABLED=0$/ { found=1 } END { exit(found?0:1) }'; then
|
|
echo "ERROR: $binary_path was built without CGO support (found CGO_ENABLED=0)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "OK: $binary_path has CGO support"
|