vendor/github.com/spf13/cobra/Makefile
changeset 256 6d9efbef00a9
child 260 445e01aede7e
equal deleted inserted replaced
255:4f153a23adab 256:6d9efbef00a9
       
     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 get github.com/kyoh86/richgo")
       
    10 endif
       
    11 
       
    12 .PHONY: fmt lint test cobra_generator install_deps clean
       
    13 
       
    14 default: all
       
    15 
       
    16 all: fmt test cobra_generator
       
    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 lint
       
    27 	$(info ******************** running tests ********************)
       
    28 	richgo test -v ./...
       
    29 
       
    30 cobra_generator: install_deps
       
    31 	$(info ******************** building generator ********************)
       
    32 	mkdir -p $(BIN)
       
    33 	make -C cobra all
       
    34 
       
    35 install_deps:
       
    36 	$(info ******************** downloading dependencies ********************)
       
    37 	go get -v ./...
       
    38 
       
    39 clean:
       
    40 	rm -rf $(BIN)