mirror of
https://github.com/spf13/cobra
synced 2024-12-26 22:37:08 +00:00
37 lines
873 B
Makefile
37 lines
873 B
Makefile
|
BIN="./bin"
|
||
|
SRC=$(shell find . -name "*.go")
|
||
|
|
||
|
ifeq (, $(shell which richgo))
|
||
|
$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo")
|
||
|
endif
|
||
|
|
||
|
.PHONY: fmt vet test cobra_generator install_deps clean
|
||
|
|
||
|
default: all
|
||
|
|
||
|
all: fmt vet test cobra_generator
|
||
|
|
||
|
fmt:
|
||
|
$(info ******************** checking formatting ********************)
|
||
|
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
|
||
|
|
||
|
test: install_deps vet
|
||
|
$(info ******************** running tests ********************)
|
||
|
richgo test -v ./...
|
||
|
|
||
|
cobra_generator: install_deps
|
||
|
$(info ******************** building generator ********************)
|
||
|
mkdir -p $(BIN)
|
||
|
make -C cobra all
|
||
|
|
||
|
install_deps:
|
||
|
$(info ******************** downloading dependencies ********************)
|
||
|
go get -v ./...
|
||
|
|
||
|
vet:
|
||
|
$(info ******************** vetting ********************)
|
||
|
go vet ./...
|
||
|
|
||
|
clean:
|
||
|
rm -rf $(BIN)
|