From 4d088c9354c17c58478cf121349a314b4e0dd322 Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Wed, 8 Jul 2026 01:06:20 +0200 Subject: set up and add sync package --- .githooks/pre-commit | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 .githooks/pre-commit (limited to '.githooks/pre-commit') diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..95ecd68 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Pre-commit hook - fast checks only +# dependencies: php git bash grep xargs composer + +set -e + +echo "🔍 Running pre-commit checks..." + +# Check if we have staged files +if git diff --cached --quiet; then + echo "No staged changes found." + exit 0 +fi + +# Lint only staged files +echo "📝 Linting staged files..." + +# Get staged Go files +STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$' || true) + +if [ -n "$STAGED_FILES" ]; then + # Run Go linting on staged files + go vet ./... + if [ $? -eq 0 ]; then + echo "✅ go vet passed" + else + echo "❌ go vet failed" + exit 1 + fi + + golangci-lint run ./... + if [ $? -eq 0 ]; then + echo "✅ golangci-lint passed" + else + echo "❌ golangci-lint failed" + exit 1 + fi +else + echo "⏭️ Nothing to lint, skipping..." +fi + +echo "🎉 Pre-commit checks completed successfully!" -- cgit v1.2.3