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.

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