github.com/jenkins-x/jx-api@v0.0.24/Makefile (about)

     1  
     2  SHELL := /bin/bash
     3  GO := GO111MODULE=on GO15VENDOREXPERIMENT=1 go
     4  GO_NOMOD := GO111MODULE=off go
     5  GOTEST := $(GO) test
     6  PACKAGE_DIRS := $(shell $(GO) list ./... | grep -v /vendor/)
     7  GO_DEPENDENCIES := $(shell find . -type f -name '*.go')
     8  
     9  build: 
    10  	$(GO) build ./...
    11  
    12  test: build
    13  	$(GOTEST) -coverprofile=coverage.out ./...
    14  
    15  test1: ## Runs single test specified by test name and optional package, eg 'make test1 TEST=TestGitCLI'
    16  	$(GOTEST) -v ./pkg/log -run $(TEST)
    17  
    18  get-fmt-deps: ## Install test dependencies
    19  	$(GO_NOMOD) get golang.org/x/tools/cmd/goimports
    20  
    21  fmt: importfmt ## Format the code
    22  	@FORMATTED=`$(GO) fmt $(PACKAGE_DIRS)`
    23  	@([[ ! -z "$(FORMATTED)" ]] && printf "Fixed unformatted files:\n$(FORMATTED)") || true
    24  
    25  importfmt: get-fmt-deps
    26  	@echo "Formatting the imports..."
    27  	goimports -w $(GO_DEPENDENCIES)
    28  
    29  .PHONY: lint
    30  lint: ## Lint the code
    31  	./hack/linter.sh
    32  
    33  .PHONY: modtidy
    34  modtidy:
    35  	$(GO) mod tidy
    36  
    37  .PHONY: coverage
    38  coverage:
    39  	$(GO) tool cover -html=coverage.out
    40  
    41  .PHONY: cover
    42  cover:
    43  	$(GO) tool cover -func coverage.out | grep total
    44  
    45  .PHONY: code-generate
    46  code-generate:
    47  	./hack/generate.sh
    48  
    49  include Makefile.codegen
    50