File: pre-commit.sh

package info (click to toggle)
golang-github-mrjones-oauth 0.0~git20170225.0.3f67d9c-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 204 kB
  • sloc: sh: 17; makefile: 5
file content (21 lines) | stat: -rwxr-xr-x 439 bytes parent folder | download | duplicates (3)
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