github.com/metacubex/quic-go@v0.44.1-0.20240520163451-20b689a59136/.githooks/pre-commit (about) 1 #!/bin/bash 2 3 # Check that test files don't contain focussed test cases. 4 errored=false 5 for f in $(git diff --diff-filter=d --cached --name-only); do 6 if [[ $f != *_test.go ]]; then continue; fi 7 output=$(git show :"$f" | grep -n -e "FIt(" -e "FContext(" -e "FDescribe(") 8 if [ $? -eq 0 ]; then 9 echo "$f contains a focussed test:" 10 echo "$output" 11 echo "" 12 errored=true 13 fi 14 done 15 16 pushd ./integrationtests/gomodvendor > /dev/null 17 go mod tidy 18 if [[ -n $(git diff --diff-filter=d --name-only -- "go.mod" "go.sum") ]]; then 19 echo "go.mod / go.sum in integrationtests/gomodvendor not tidied" 20 errored=true 21 fi 22 popd > /dev/null 23 24 # Check that all Go files are properly gofumpt-ed. 25 output=$(gofumpt -d $(git diff --diff-filter=d --cached --name-only -- '*.go')) 26 if [ -n "$output" ]; then 27 echo "Found files that are not properly gofumpt-ed." 28 echo "$output" 29 errored=true 30 fi 31 32 if [ "$errored" = true ]; then 33 exit 1 34 fi