Skip to content

Instantly share code, notes, and snippets.

@mldbk
Created January 2, 2018 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mldbk/8da9cd86469dcddba6390bc10de3fb29 to your computer and use it in GitHub Desktop.
Save mldbk/8da9cd86469dcddba6390bc10de3fb29 to your computer and use it in GitHub Desktop.
git pre-commit hook for Golang
#!/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