tendermint/Makefile

100 lines
2.3 KiB
Makefile
Raw Normal View History

2017-04-19 08:07:12 -07:00
GOTOOLS = \
github.com/golang/dep/cmd/dep \
2018-01-02 13:25:01 -08:00
# gopkg.in/alecthomas/gometalinter.v2 \
GOTOOLS_CHECK = dep #gometalinter.v2
2018-03-12 01:34:43 -07:00
all: check get_vendor_deps build test install
2017-02-22 14:15:10 -08:00
2017-12-26 00:28:07 -08:00
check: check_tools
2017-04-19 08:07:12 -07:00
2017-12-26 00:28:07 -08:00
########################################
### Build
# Command to generate the workd list (kept here for documentation purposes only):
2018-05-15 04:23:33 -07:00
wordlist:
# To re-generate wordlist.go run:
# go-bindata -ignore ".*\.go" -o keys/words/wordlist/wordlist.go -pkg "wordlist" keys/words/wordlist/...
2017-12-26 00:28:07 -08:00
2018-05-15 04:23:33 -07:00
build: wordlist
# Nothing else to build!
2017-12-26 00:28:07 -08:00
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)
2018-01-02 13:25:01 -08:00
#@gometalinter.v2 --install
2017-12-26 00:28:07 -08:00
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
get_vendor_deps:
2017-04-19 08:07:12 -07:00
@rm -rf vendor/
@echo "--> Running dep ensure"
@dep ensure
2017-04-19 08:07:12 -07:00
2017-12-26 00:28:07 -08:00
########################################
### Testing
2017-12-26 00:28:07 -08:00
test:
2018-02-25 09:41:32 -08:00
go test -p 1 $(shell go list ./... | grep -v vendor)
2017-12-26 00:28:07 -08:00
########################################
### Formatting, linting, and vetting
2017-12-26 00:28:07 -08:00
fmt:
@go fmt ./...
metalinter:
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
--enable=goconst \
2017-12-26 00:28:07 -08:00
--enable=goimports \
--enable=gosimple \
2017-12-26 00:28:07 -08:00
--enable=ineffassign \
--enable=megacheck \
2017-12-26 00:28:07 -08:00
--enable=misspell \
--enable=staticcheck \
2017-12-26 00:28:07 -08:00
--enable=safesql \
--enable=structcheck \
2017-12-26 00:28:07 -08:00
--enable=unconvert \
--enable=unused \
--enable=varcheck \
2017-11-15 04:57:17 -08:00
--enable=vetshadow \
./...
2017-12-26 00:28:07 -08:00
#--enable=gas \
#--enable=dupl \
#--enable=errcheck \
2017-12-26 00:28:07 -08:00
#--enable=gocyclo \
#--enable=golint \ <== comments on anything exported
2017-10-04 15:16:48 -07:00
#--enable=gotype \
2017-12-26 00:28:07 -08:00
#--enable=interfacer \
2017-10-04 15:27:35 -07:00
#--enable=unparam \
2017-12-26 00:28:07 -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
.PHONEY: check build install check_tools get_tools update_tools get_vendor_deps test fmt metalinter metalinter_all