Makefile 903 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. .PHONY: default install build test quicktest fmt vet lint
  2. default: fmt vet lint build quicktest
  3. install:
  4. go get -t -v ./...
  5. build:
  6. go build -v ./...
  7. test:
  8. go test -v -cover ./...
  9. quicktest:
  10. go test ./...
  11. # Capture output and force failure when there is non-empty output
  12. fmt:
  13. @echo gofmt -l .
  14. @OUTPUT=`gofmt -l . 2>&1`; \
  15. if [ "$$OUTPUT" ]; then \
  16. echo "gofmt must be run on the following files:"; \
  17. echo "$$OUTPUT"; \
  18. exit 1; \
  19. fi
  20. # Only run on go1.5+
  21. vet:
  22. go tool vet -atomic -bool -copylocks -nilfunc -printf -shadow -rangeloops -unreachable -unsafeptr -unusedresult .
  23. # https://github.com/golang/lint
  24. # go get github.com/golang/lint/golint
  25. # Capture output and force failure when there is non-empty output
  26. # Only run on go1.5+
  27. lint:
  28. @echo golint ./...
  29. @OUTPUT=`golint ./... 2>&1`; \
  30. if [ "$$OUTPUT" ]; then \
  31. echo "golint errors:"; \
  32. echo "$$OUTPUT"; \
  33. exit 1; \
  34. fi