Scott Baker | eee8dd8 | 2019-09-24 12:52:34 -0700 | [diff] [blame^] | 1 | export GO111MODULE=on |
| 2 | |
| 3 | default: fmt vet errcheck test |
| 4 | |
| 5 | # Taken from https://github.com/codecov/example-go#caveat-multiple-files |
| 6 | test: |
| 7 | echo "" > coverage.txt |
| 8 | for d in `go list ./... | grep -v vendor`; do \ |
| 9 | go test -p 1 -v -timeout 240s -race -coverprofile=profile.out -covermode=atomic $$d || exit 1; \ |
| 10 | if [ -f profile.out ]; then \ |
| 11 | cat profile.out >> coverage.txt; \ |
| 12 | rm profile.out; \ |
| 13 | fi \ |
| 14 | done |
| 15 | |
| 16 | vet: |
| 17 | go vet ./... |
| 18 | |
| 19 | # See https://github.com/kisielk/errcheck/pull/141 for details on ignorepkg |
| 20 | errcheck: |
| 21 | errcheck -ignorepkg fmt github.com/Shopify/sarama/... |
| 22 | |
| 23 | fmt: |
| 24 | @if [ -n "$$(go fmt ./...)" ]; then echo 'Please run go fmt on your code.' && exit 1; fi |
| 25 | |
| 26 | install_dependencies: install_errcheck get |
| 27 | |
| 28 | install_errcheck: |
| 29 | go get github.com/kisielk/errcheck |
| 30 | |
| 31 | get: |
| 32 | go get -t |