Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. ifeq (, $(shell which richgo))
  7. $(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
  8. endif
  9. .PHONY: fmt lint test cobra_generator install_deps clean
  10. default: all
  11. all: fmt test cobra_generator
  12. fmt:
  13. $(info ******************** checking formatting ********************)
  14. @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
  15. lint:
  16. $(info ******************** running lint tools ********************)
  17. golangci-lint run -v
  18. test: install_deps lint
  19. $(info ******************** running tests ********************)
  20. richgo test -v ./...
  21. cobra_generator: install_deps
  22. $(info ******************** building generator ********************)
  23. mkdir -p $(BIN)
  24. make -C cobra all
  25. install_deps:
  26. $(info ******************** downloading dependencies ********************)
  27. go get -v ./...
  28. clean:
  29. rm -rf $(BIN)