beads/scripts/check-go-install-guidance.sh
matt wilkie 602593b47d
fix(install): use declared module path for go fallback (#4215)
The repository has moved to gastownhall/beads, but released Go modules still declare github.com/steveyegge/beads. The installer fallback should use the declared module path, and the docs/check should keep future guidance from regressing.

_codex-gpt-5.5-medium on behalf of matt wilkie_
2026-05-27 21:48:24 -07:00

49 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Guard user-facing docs and hints against unsupported first-party go install forms.
#
# Plain `go install github.com/.../beads/cmd/bd@latest` takes the CGO+ICU path
# on many hosts. Keep first-party guidance on one of the documented supported
# modes:
# - CGO_ENABLED=0 ... (server-mode only)
# - ... gms_pure_go ... (embedded-capable, no ICU)
set -euo pipefail
fail=0
while IFS= read -r hit; do
file="${hit%%:*}"
rest="${hit#*:}"
line_no="${rest%%:*}"
printf 'error: %s:%s: unsupported go install module path\n' "$file" "$line_no" >&2
printf ' use github.com/steveyegge/beads/cmd/bd because go.mod still declares that module path\n' >&2
fail=1
done < <(
git grep -n -E 'go install github\.com/gastownhall/beads/cmd/bd@latest' -- . || true
)
while IFS= read -r hit; do
file="${hit%%:*}"
rest="${hit#*:}"
line_no="${rest%%:*}"
line="${rest#*:}"
case "$file" in
CHANGELOG.md|docs/GETTING_STARTED_ANALYSIS.md)
continue
;;
esac
if [[ "$line" == *"CGO_ENABLED=0"* || "$line" == *'CGO_ENABLED="0"'* || "$line" == *"gms_pure_go"* ]]; then
continue
fi
printf 'error: %s:%s: unsupported first-party bare go install guidance\n' "$file" "$line_no" >&2
printf ' use CGO_ENABLED=0 for server mode or GOFLAGS=-tags=gms_pure_go for embedded mode\n' >&2
fail=1
done < <(
git grep -n -E 'go install github\.com/(steveyegge|gastownhall)/beads/cmd/bd@latest' -- . || true
)
exit "$fail"