Skip to content

Commit c66b4ed

Browse files
authored
Merge pull request #9 from airframesio/copilot/sub-pr-4
Fix pre-commit hook to prevent commits with unformatted code
2 parents d8cc4a8 + 6e34736 commit c66b4ed

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.githooks/pre-commit

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ if ! go fmt ./...; then
2020
echo "Run 'go fmt ./...' to fix formatting"
2121
exit 1
2222
fi
23+
if ! git diff --quiet; then
24+
echo -e "${RED}✗ Formatting changes applied. Please review and re-stage before committing.${NC}"
25+
exit 1
26+
fi
2327
echo -e "${GREEN}✓ Code formatting OK${NC}"
2428

2529
# 2. Run go vet

0 commit comments

Comments
 (0)