git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/cobra/Makefile (about) 1 BIN="./bin" 2 SRC=$(shell find . -name "*.go") 3 4 ifeq (, $(shell which golangci-lint)) 5 $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") 6 endif 7 8 ifeq (, $(shell which richgo)) 9 $(warning "could not find richgo in $(PATH), run: go install github.com/kyoh86/richgo@latest") 10 endif 11 12 .PHONY: fmt lint test install_deps clean 13 14 default: all 15 16 all: fmt test 17 18 fmt: 19 $(info ******************** checking formatting ********************) 20 @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) 21 22 lint: 23 $(info ******************** running lint tools ********************) 24 golangci-lint run -v 25 26 test: install_deps 27 $(info ******************** running tests ********************) 28 richgo test -v ./... 29 30 install_deps: 31 $(info ******************** downloading dependencies ********************) 32 go get -v ./... 33 34 clean: 35 rm -rf $(BIN)