forked from uber-go/zap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Makefile to assume a single package
- Loading branch information
Akshay Shah
committed
Mar 31, 2016
1 parent
847537a
commit f0c22a1
Showing
1 changed file
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,60 @@ | ||
export GO15VENDOREXPERIMENT=1 | ||
|
||
BENCH_FLAGS ?= -cpuprofile=cpu.pprof -memprofile=mem.pprof -benchmem | ||
PACKAGES ?= $(shell glide novendor) | ||
PKGS ?= $(shell glide novendor) | ||
# Many Go tools take file globs or directories as arguments instead of packages. | ||
PKG_DIRS ?= *.go | ||
|
||
# The linting tools evolve with each Go version, so run them only on the latest | ||
# stable release. | ||
GO_VERSION := $(shell go version | cut -d " " -f 3) | ||
GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION))) | ||
LINTABLE_MINOR_VERSIONS := 6 | ||
ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),) | ||
SHOULD_LINT := true | ||
endif | ||
|
||
|
||
.PHONY: all | ||
all: lint test | ||
|
||
.PHONY: dependencies | ||
dependencies: | ||
@echo "Installing Glide and locked dependencies..." | ||
glide --version || go get -u -f github.com/Masterminds/glide | ||
glide install | ||
go install ./vendor/github.com/golang/lint/golint | ||
@echo "Installing test dependencies..." | ||
go install ./vendor/github.com/axw/gocov/gocov | ||
go install ./vendor/github.com/mattn/goveralls | ||
ifdef SHOULD_LINT | ||
@echo "Installing golint..." | ||
go install ./vendor/github.com/golang/lint/golint | ||
else | ||
@echo "Not installing golint, since we don't expect to lint on" $(GO_VERSION) | ||
endif | ||
|
||
.PHONY: lint | ||
lint: | ||
@rm -rf lint.log | ||
@echo "Checking formatting..." | ||
@gofmt -d -s *.go benchmarks encoder 2>&1 | tee lint.log | ||
@gofmt -d -s $(PKG_DIRS) 2>&1 | tee lint.log | ||
@echo "Checking vet..." | ||
@go tool vet *.go 2>&1 | tee -a lint.log | ||
@go tool vet benchmarks 2>&1 | tee -a lint.log | ||
@go tool vet encoder 2>&1 | tee -a lint.log | ||
@$(foreach dir,$(PKG_DIRS),go tool vet $(dir) 2>&1 | tee -a lint.log;) | ||
@echo "Checking lint..." | ||
@golint . 2>&1 | tee -a lint.log | ||
@golint benchmarks 2>&1 | tee -a lint.log | ||
@golint encoder 2>&1 | tee -a lint.log | ||
@$(foreach dir,$(PKG_DIRS),golint $(dir) 2>&1 | tee -a lint.log;) | ||
@echo "Checking for unresolved FIXMEs..." | ||
@git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log | ||
@[ ! -s lint.log ] | ||
|
||
.PHONY: test | ||
test: | ||
go test -race $(PACKAGES) | ||
go test -race $(PKGS) | ||
|
||
.PHONY: coveralls | ||
coveralls: | ||
goveralls -service=travis-ci $(PACKAGES) | ||
goveralls -service=travis-ci $(PKGS) | ||
|
||
.PHONY: bench | ||
BENCH ?= . | ||
bench: | ||
go test -bench=$(BENCH) $(BENCH_FLAGS) ./benchmarks | ||
go test -bench=$(BENCH) $(BENCH_FLAGS) . |