🧱 Chunk is a download manager for slow and unstable servers
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Pre commit hooks (#26)

Closes #16

authored by

Vinnie Mesel and committed by
GitHub
d4114619 3b8576ae

+28
+22
.githooks/pre-commit
··· 1 + #!/bin/bash 2 + function checkExitCode () { 3 + echo "[running] $2" 4 + ($1) 5 + exitCheck=$? 6 + if [[ $exitCheck != 0 ]] ; then 7 + echo "[FAILED] $2" 8 + exit 1 9 + fi 10 + echo "[done] $2" 11 + } 12 + 13 + echo "####### Pre-commit hook Starting #######" 14 + checkExitCode 'staticcheck ./...' 'Staticcheck' 15 + echo "[running] Gofmt" 16 + if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then 17 + echo "[FAILED] Gofmt failed" 18 + exit 1 19 + fi 20 + echo "[done] Gofmt" 21 + checkExitCode 'go test -race ./...' 'Go test' 22 + echo "####### Pre-commit hook Finished #######"
+6
CONTRIBUTING.md
··· 9 9 $ staticcheck ./... 10 10 $ go test -race ./... 11 11 ``` 12 + 13 + To make it easy for you, we have pre-commit hooks set up: 14 + 15 + ```console 16 + $ git config core.hooksPath .githooks 17 + ```