🤖 chore: finalize Git hooks implementation and documentation
- Complete Git hooks setup with staged-only formatting - Add comprehensive documentation and ADR - Fix BDD step template syntax error - Update commit_message skill with hooks integration - Verify all hooks work correctly Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -25,18 +25,18 @@ if git diff --cached --name-only | grep -qE '(go\.mod|go\.sum)'; then
|
||||
git add go.mod go.sum
|
||||
fi
|
||||
|
||||
# Run go fmt on all Go files
|
||||
echo "Running go fmt..."
|
||||
GOFILES=$(find . -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
||||
if [ -n "$GOFILES" ]; then
|
||||
gofmt -w $GOFILES
|
||||
# Run go fmt on staged Go files only
|
||||
echo "Running go fmt on staged files..."
|
||||
STAGED_GOFILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
|
||||
if [ -n "$STAGED_GOFILES" ]; then
|
||||
gofmt -w $STAGED_GOFILES
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: go fmt failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add formatted files to commit
|
||||
git add $GOFILES
|
||||
git add $STAGED_GOFILES
|
||||
fi
|
||||
|
||||
echo "Pre-commit hooks completed successfully"
|
||||
|
||||
Reference in New Issue
Block a user