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.

Makefile 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Targets:
  2. #
  3. # all: Builds the code locally after testing
  4. #
  5. # fmt: Formats the source files
  6. # fmt-check: Check if the source files are formated
  7. # build: Builds the code locally
  8. # vet: Vets the code
  9. # lint: Runs lint over the code (you do not need to fix everything)
  10. # test: Runs the tests
  11. # cover: Gives you the URL to a nice test coverage report
  12. #
  13. # install: Builds, tests and installs the code locally
  14. GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
  15. .PHONY: all fmt build vet lint test cover install
  16. # The first target is always the default action if `make` is called without
  17. # args we build and install into $GOPATH so that it can just be run
  18. all: fmt vet test install
  19. fmt:
  20. @gofmt -s -w ${GOFILES_NOVENDOR}
  21. fmt-check:
  22. @([ -z "$(shell gofmt -d $(GOFILES_NOVENDOR) | head)" ]) || (echo "Source is unformatted"; exit 1)
  23. build:
  24. @go build
  25. vet:
  26. @go vet
  27. lint:
  28. @golint *.go
  29. test:
  30. @go test -v ./...
  31. cover: COVERAGE_FILE := coverage.out
  32. cover:
  33. @go test -coverprofile=$(COVERAGE_FILE) && \
  34. cover -html=$(COVERAGE_FILE) && rm $(COVERAGE_FILE)
  35. install:
  36. @go install ./...