blob: 1ef263075d762d1ce598eb31fd218bfa28b5a16a [file] [log] [blame]
Scott Baker2d897982019-09-24 11:50:08 -07001# Many Go tools take file globs or directories as arguments instead of packages.
2PACKAGE_FILES ?= *.go
3
Scott Baker8487c5d2019-10-18 12:49:46 -07004# For pre go1.6
Scott Baker2d897982019-09-24 11:50:08 -07005export GO15VENDOREXPERIMENT=1
6
7
8.PHONY: build
9build:
Scott Baker8487c5d2019-10-18 12:49:46 -070010 go build -i ./...
Scott Baker2d897982019-09-24 11:50:08 -070011
12
13.PHONY: install
14install:
15 glide --version || go get github.com/Masterminds/glide
16 glide install
17
18
19.PHONY: test
20test:
Scott Baker8487c5d2019-10-18 12:49:46 -070021 go test -cover -race ./...
Scott Baker2d897982019-09-24 11:50:08 -070022
23
24.PHONY: install_ci
25install_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 Baker8487c5d2019-10-18 12:49:46 -070029
30.PHONY: install_lint
31install_lint:
32 go get golang.org/x/lint/golint
33
Scott Baker2d897982019-09-24 11:50:08 -070034
35.PHONY: lint
36lint:
Scott Baker2d897982019-09-24 11:50:08 -070037 @rm -rf lint.log
38 @echo "Checking formatting..."
39 @gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log
40 @echo "Checking vet..."
Scott Baker8487c5d2019-10-18 12:49:46 -070041 @go vet ./... 2>&1 | tee -a lint.log;)
Scott Baker2d897982019-09-24 11:50:08 -070042 @echo "Checking lint..."
Scott Baker8487c5d2019-10-18 12:49:46 -070043 @golint $$(go list ./...) 2>&1 | tee -a lint.log
Scott Baker2d897982019-09-24 11:50:08 -070044 @echo "Checking for unresolved FIXMEs..."
45 @git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log
46 @[ ! -s lint.log ]
Scott Baker2d897982019-09-24 11:50:08 -070047
48
49.PHONY: test_ci
50test_ci: install_ci build
51 ./scripts/cover.sh $(shell go list $(PACKAGES))