You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
439 B

  1. #!/bin/bash
  2. # ln -s $PWD/pre-commit.sh .git/hooks/pre-commit
  3. go test *.go
  4. RESULT=$?
  5. if [[ $RESULT != 0 ]]; then
  6. echo "REJECTING COMMIT (test failed with status: $RESULT)"
  7. exit 1;
  8. fi
  9. go fmt *.go
  10. for e in $(ls examples); do
  11. go build examples/$e/*.go
  12. RESULT=$?
  13. if [[ $RESULT != 0 ]]; then
  14. echo "REJECTING COMMIT (Examples failed to compile)"
  15. exit $RESULT;
  16. fi
  17. go fmt examples/$e/*.go
  18. done
  19. exit 0