tendermint/Makefile

97 lines
2.1 KiB
Makefile
Raw Normal View History

2017-05-05 21:52:01 +04:00
.PHONY: all test get_vendor_deps ensure_tools
2017-04-25 17:48:10 -04:00
GOTOOLS = \
github.com/Masterminds/glide \
2017-12-25 22:41:40 -08:00
github.com/alecthomas/gometalinter.v2
GOTOOLS_CHECK = glide gometalinter.v2
2017-12-25 22:41:40 -08:00
all: check get_vendor_deps build test install metalinter
2017-04-25 17:48:10 -04:00
2017-12-25 22:41:40 -08:00
check: check_tools
2017-05-05 21:52:01 +04:00
2017-12-25 22:41:40 -08:00
########################################
### Build
build:
# Nothing to build!
install:
# Nothing to install!
########################################
### Tools & dependencies
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
2017-04-25 17:48:10 -04:00
2017-12-25 22:41:40 -08:00
get_vendor_deps:
2017-04-25 17:48:10 -04:00
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
2017-12-25 22:41:40 -08:00
########################################
### Testing
2017-12-25 22:41:40 -08:00
test:
go test -tags gcc `glide novendor`
########################################
### Formatting, linting, and vetting
fmt:
@go fmt ./...
metalinter:
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
--enable=goconst \
2017-12-25 22:41:40 -08:00
--enable=goimports \
--enable=gosimple \
--enable=ineffassign \
--enable=megacheck \
--enable=misspell \
--enable=staticcheck \
--enable=safesql \
--enable=structcheck \
--enable=unconvert \
--enable=unused \
--enable=varcheck \
--enable=vetshadow \
./...
2017-12-25 22:41:40 -08:00
#--enable=gas \
#--enable=dupl \
#--enable=errcheck \
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
2017-10-03 12:18:21 -04:00
#--enable=gotype \
2017-12-25 22:41:40 -08:00
#--enable=interfacer \
#--enable=unparam \
2017-12-25 22:41:40 -08:00
#--enable=vet \
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check build check_tools get_tools update_tools get_vendor_deps test fmt metalinter metalinter_all