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

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