You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.3 KiB

  1. GOTOOLS = \
  2. github.com/golang/dep/cmd/dep \
  3. # gopkg.in/alecthomas/gometalinter.v2 \
  4. GOTOOLS_CHECK = dep #gometalinter.v2
  5. all: check get_vendor_deps build test install
  6. check: check_tools
  7. ########################################
  8. ### Build
  9. # Command to generate the workd list (kept here for documentation purposes only):
  10. wordlist:
  11. # To re-generate wordlist.go run:
  12. # go-bindata -ignore ".*\.go" -o keys/words/bip39/wordlist.go -pkg "wordlist" keys/bip39/wordlist/...
  13. build: wordlist
  14. # Nothing else to build!
  15. install:
  16. # Nothing to install!
  17. ########################################
  18. ### Tools & dependencies
  19. check_tools:
  20. @# https://stackoverflow.com/a/25668869
  21. @echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
  22. $(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
  23. get_tools:
  24. @echo "--> Installing tools"
  25. go get -u -v $(GOTOOLS)
  26. #@gometalinter.v2 --install
  27. update_tools:
  28. @echo "--> Updating tools"
  29. @go get -u $(GOTOOLS)
  30. get_vendor_deps:
  31. @rm -rf vendor/
  32. @echo "--> Running dep ensure"
  33. @dep ensure
  34. ########################################
  35. ### Testing
  36. test:
  37. CGO_ENABLED=0 go test -p 1 $(shell go list ./... | grep -v vendor)
  38. ########################################
  39. ### Formatting, linting, and vetting
  40. fmt:
  41. @go fmt ./...
  42. metalinter:
  43. @echo "==> Running linter"
  44. gometalinter.v2 --vendor --deadline=600s --disable-all \
  45. --enable=maligned \
  46. --enable=deadcode \
  47. --enable=goconst \
  48. --enable=goimports \
  49. --enable=gosimple \
  50. --enable=ineffassign \
  51. --enable=megacheck \
  52. --enable=misspell \
  53. --enable=staticcheck \
  54. --enable=safesql \
  55. --enable=structcheck \
  56. --enable=unconvert \
  57. --enable=unused \
  58. --enable=varcheck \
  59. --enable=vetshadow \
  60. ./...
  61. #--enable=gas \
  62. #--enable=dupl \
  63. #--enable=errcheck \
  64. #--enable=gocyclo \
  65. #--enable=golint \ <== comments on anything exported
  66. #--enable=gotype \
  67. #--enable=interfacer \
  68. #--enable=unparam \
  69. #--enable=vet \
  70. metalinter_all:
  71. protoc $(INCLUDE) --lint_out=. types/*.proto
  72. gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
  73. # To avoid unintended conflicts with file names, always add to .PHONY
  74. # unless there is a reason not to.
  75. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
  76. .PHONEY: check build install check_tools get_tools update_tools get_vendor_deps test fmt metalinter metalinter_all