add a pre-commit hook that check that files are properly gofumpt-ed

This commit is contained in:
Marten Seemann
2021-01-02 18:02:59 +08:00
parent c4789ccb28
commit 12571e3668

View File

@@ -13,6 +13,14 @@ for f in $(git diff --cached --name-only); do
fi
done
# Check that all files are properly gofumpt-ed.
output=$(gofumpt -d $(git diff --cached --name-only))
if [ -n "$output" ]; then
echo "Found files that are not properly gofumpt-ed."
echo "$output"
errored=true
fi
if [ "$errored" = true ]; then
exit 1
fi