Платформа ЦРНП "Мирокод" для разработки проектов
https://git.mirocod.ru
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
21 lines
439 B
#!/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
|
|
|