Created
January 2, 2018 16:13
-
-
Save mldbk/8da9cd86469dcddba6390bc10de3fb29 to your computer and use it in GitHub Desktop.
git pre-commit hook for Golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
check_exit() { | |
if [ $? -eq 1 ]; then | |
printf "linting failed when running $1...\n" | |
exit 1 | |
fi | |
} | |
go vet $(glide nv) | |
check_exit "go vet" | |
gosimple $(glide nv) | |
check_exit "gosimple" | |
unused $(glide nv) | |
check_exit "unused" | |
staticcheck $(glide nv) | |
check_exit "staticcheck" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment