src: Add DMA localagent
[barometer.git] / src / dma / vendor / github.com / streadway / amqp / pre-commit
1 #!/bin/sh
2
3 GOFMT_FILES=$(gofmt -l .)
4 if [ -n "${GOFMT_FILES}" ]; then
5   printf >&2 'gofmt failed for the following files:\n%s\n\nplease run "gofmt -w ." on your changes before committing.\n' "${GOFMT_FILES}"
6   exit 1
7 fi
8
9 GOLINT_ERRORS=$(golint ./... | grep -v "Id should be")
10 if [ -n "${GOLINT_ERRORS}" ]; then
11   printf >&2 'golint failed for the following reasons:\n%s\n\nplease run 'golint ./...' on your changes before committing.\n' "${GOLINT_ERRORS}"
12   exit 1
13 fi
14
15 GOVET_ERRORS=$(go tool vet *.go 2>&1)
16 if [ -n "${GOVET_ERRORS}" ]; then
17   printf >&2 'go vet failed for the following reasons:\n%s\n\nplease run "go tool vet *.go" on your changes before committing.\n' "${GOVET_ERRORS}"
18   exit 1
19 fi
20
21 if [ -z "${NOTEST}" ]; then
22   printf >&2 'Running short tests...\n'
23   env AMQP_URL= go test -short -v | egrep 'PASS|ok'
24
25   if [ $? -ne 0 ]; then
26     printf >&2 'go test failed, please fix before committing.\n'
27     exit 1
28   fi
29 fi