Makefile 907 B

1234567891011121314151617181920212223242526272829303132333435
  1. BIN="./bin"
  2. SRC=$(shell find . -name "*.go")
  3. ifeq (, $(shell which golangci-lint))
  4. $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
  5. endif
  6. .PHONY: fmt lint test install_deps clean
  7. default: all
  8. all: fmt test
  9. fmt:
  10. $(info ******************** checking formatting ********************)
  11. @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
  12. lint:
  13. $(info ******************** running lint tools ********************)
  14. golangci-lint run -v
  15. test: install_deps
  16. $(info ******************** running tests ********************)
  17. go test -v ./...
  18. richtest: install_deps
  19. $(info ******************** running tests with kyoh86/richgo ********************)
  20. richgo test -v ./...
  21. install_deps:
  22. $(info ******************** downloading dependencies ********************)
  23. go get -v ./...
  24. clean:
  25. rm -rf $(BIN)