working commit

This commit is contained in:
2026-05-26 17:11:13 +02:00
commit 2e59f88d76
103 changed files with 18276 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
MAX_SIZE=1024 # 1 MB limit in KB
for file in $(git diff --cached --name-only --diff-filter=ACM); do
if [ ! -e "$file" ]; then continue; fi
size=$(du -k "$file" | cut -f1)
if [ $size -gt $MAX_SIZE ]; then
echo "Error: File $file is larger than the allowed size of $((MAX_SIZE / 1024)) MB."
exit 1
fi
done
status=0
for file in $(git diff --cached --name-only | grep -E '\.go$'); do
badfile=$(gofmt -l "$file")
if test -n "$badfile" ; then
echo "Error: file needs gofmt: $badfile"
status=1
fi
done
# If any files were not formatted, exit with a non-zero status to abort the commit.
if [ "$status" -ne 0 ]; then
echo "git pre-commit check failed: some Go files are not formatted."
exit 1
fi
exit 0