Skip to content

Commit 722936a

Browse files
committed
Add agent backoff and CI guardrails
1 parent b6d2093 commit 722936a

14 files changed

Lines changed: 618 additions & 217 deletions

File tree

.githooks/pre-commit

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(git rev-parse --show-toplevel)"
5+
6+
if ! command -v golangci-lint >/dev/null 2>&1; then
7+
echo "golangci-lint is required for this hook. Install it first."
8+
echo " brew install golangci-lint"
9+
exit 1
10+
fi
11+
12+
hash_file() {
13+
if [ -f "$1" ]; then
14+
git hash-object "$1"
15+
fi
16+
}
17+
18+
cleanup() { rm -rf .tmp-bin; }
19+
trap cleanup EXIT
20+
21+
echo "Verifying modules..."
22+
go mod verify
23+
24+
echo "Checking module tidiness..."
25+
before_mod="$(hash_file go.mod)"
26+
before_sum="$(hash_file go.sum)"
27+
go mod tidy
28+
after_mod="$(hash_file go.mod)"
29+
after_sum="$(hash_file go.sum)"
30+
if [ "$before_mod" != "$after_mod" ] || [ "$before_sum" != "$after_sum" ]; then
31+
echo "go mod tidy changed go.mod or go.sum. Review and stage those updates first."
32+
exit 1
33+
fi
34+
35+
echo "Running tests..."
36+
CGO_ENABLED=1 go test -race ./...
37+
38+
echo "Running lint..."
39+
golangci-lint run ./...
40+
41+
echo "Building sah..."
42+
mkdir -p .tmp-bin
43+
go build -o .tmp-bin/sah ./cmd/sah

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin/
22
dist/
33
coverage.out
4+
.tmp-bin/

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: "2"
2+
13
linters:
24
enable:
35
- bodyclose

0 commit comments

Comments
 (0)