summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mrjones/oauth/pre-commit.sh
blob: 91b9e88236074954b05e3c5c57b7c851cfc19e0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# ln -s $PWD/pre-commit.sh .git/hooks/pre-commit
go test *.go
RESULT=$?
if [[ $RESULT != 0 ]]; then
    echo "REJECTING COMMIT (test failed with status: $RESULT)"
    exit 1;
fi

go fmt *.go
for e in $(ls examples); do 
    go build examples/$e/*.go
    RESULT=$?
    if [[ $RESULT != 0 ]]; then
        echo "REJECTING COMMIT (Examples failed to compile)"
        exit $RESULT;
    fi
    go fmt examples/$e/*.go
done

exit 0