Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. SRCS := $(shell find . -name '*.go')
  2. BIN_DEPS := \
  3. github.com/golang/lint/golint \
  4. github.com/kisielk/errcheck \
  5. honnef.co/go/tools/cmd/staticcheck \
  6. honnef.co/go/tools/cmd/unused
  7. .PHONY: all
  8. all: test
  9. .PHONY: deps
  10. deps:
  11. go get -d -v ./...
  12. .PHONY: updatedeps
  13. updatedeps:
  14. go get -d -v -u -f ./...
  15. .PHONY: bindeps
  16. bindeps:
  17. go get -v $(BIN_DEPS)
  18. .PHONY: updatebindeps
  19. updatebindeps:
  20. go get -u -v $(BIN_DEPS)
  21. .PHONY: testdeps
  22. testdeps: bindeps
  23. go get -d -v -t ./...
  24. .PHONY: updatetestdeps
  25. updatetestdeps: updatebindeps
  26. go get -d -v -t -u -f ./...
  27. .PHONY: install
  28. install: deps
  29. go install ./...
  30. .PHONY: golint
  31. golint: testdeps
  32. @# TODO: readd cmd/proto2gql when fixed
  33. @#for file in $(SRCS); do
  34. for file in $(shell echo $(SRCS) | grep -v cmd/proto2gql); do \
  35. golint $${file}; \
  36. if [ -n "$$(golint $${file})" ]; then \
  37. exit 1; \
  38. fi; \
  39. done
  40. .PHONY: vet
  41. vet: testdeps
  42. go vet ./...
  43. .PHONY: testdeps
  44. errcheck: testdeps
  45. errcheck ./...
  46. .PHONY: staticcheck
  47. staticcheck: testdeps
  48. staticcheck ./...
  49. .PHONY: unused
  50. unused: testdeps
  51. unused ./...
  52. .PHONY: lint
  53. # TODO: readd errcheck and unused when fixed
  54. #lint: golint vet errcheck staticcheck unused
  55. lint: golint vet staticcheck
  56. .PHONY: test
  57. test: testdeps lint
  58. go test -race ./...
  59. .PHONY: clean
  60. clean:
  61. go clean -i ./...
  62. integration:
  63. PB=y go test -cover