khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 1 | # Many Go tools take file globs or directories as arguments instead of packages. |
| 2 | PACKAGE_FILES ?= *.go |
| 3 | |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 4 | # For pre go1.6 |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 5 | export GO15VENDOREXPERIMENT=1 |
| 6 | |
| 7 | |
| 8 | .PHONY: build |
| 9 | build: |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 10 | go build -i ./... |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 11 | |
| 12 | |
| 13 | .PHONY: install |
| 14 | install: |
| 15 | glide --version || go get github.com/Masterminds/glide |
| 16 | glide install |
| 17 | |
| 18 | |
| 19 | .PHONY: test |
| 20 | test: |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 21 | go test -cover -race ./... |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 22 | |
| 23 | |
| 24 | .PHONY: install_ci |
| 25 | install_ci: install |
| 26 | go get github.com/wadey/gocovmerge |
| 27 | go get github.com/mattn/goveralls |
| 28 | go get golang.org/x/tools/cmd/cover |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 29 | |
| 30 | .PHONY: install_lint |
| 31 | install_lint: |
| 32 | go get golang.org/x/lint/golint |
| 33 | |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 34 | |
| 35 | .PHONY: lint |
| 36 | lint: |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 37 | @rm -rf lint.log |
| 38 | @echo "Checking formatting..." |
| 39 | @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log |
| 40 | @echo "Checking vet..." |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 41 | @go vet ./... 2>&1 | tee -a lint.log;) |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 42 | @echo "Checking lint..." |
Scott Baker | beb3cfa | 2019-10-01 14:44:30 -0700 | [diff] [blame^] | 43 | @golint $$(go list ./...) 2>&1 | tee -a lint.log |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 44 | @echo "Checking for unresolved FIXMEs..." |
| 45 | @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log |
| 46 | @[ ! -s lint.log ] |
khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 47 | |
| 48 | |
| 49 | .PHONY: test_ci |
| 50 | test_ci: install_ci build |
| 51 | ./scripts/cover.sh $(shell go list $(PACKAGES)) |