🔧 Updated Makefile
This commit is contained in:
parent
043ebeba8f
commit
f0c210e6a8
19
Makefile
19
Makefile
|
@ -1,32 +1,29 @@
|
|||
PROJECT_NAMESPACE := $(CI_PROJECT_NAMESPACE)
|
||||
PROJECT_NAME := $(CI_PROJECT_NAME)
|
||||
PROJECT_PATH := $(PROJECT_NAMESPACE)/$(PROJECT_NAME)
|
||||
PROJECT_PATH := "$(PROJECT_NAMESPACE)/$(PROJECT_NAME)"
|
||||
PACKAGE_NAME := "gitlab.com/$(PROJECT_PATH)"
|
||||
PACKAGE_PATH := $(GOPATH)/src/$(PACKAGE_NAME)
|
||||
PACKAGE_PATH := "$(GOPATH)/src/$(PACKAGE_NAME)"
|
||||
PACKAGE_LIST := $(shell go list $(PACKAGE_NAME)/... | grep -v /vendor/)
|
||||
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
|
||||
|
||||
.PHONY: all lint test rase coverage dep build clean
|
||||
.PHONY: all lint test rase coverage dep
|
||||
|
||||
all: build
|
||||
all: dep test race lint
|
||||
|
||||
lint: ## Lint the files
|
||||
@gocritic check-project $(PACKAGE_PATH)
|
||||
@golangci-lint run ./...
|
||||
|
||||
test: ## Run unittests
|
||||
@go test -short ${PACKAGE_LIST}
|
||||
@go test -short $(PACKAGE_NAME)/...
|
||||
|
||||
race: dep ## Run data race detector
|
||||
@go test -race -short ${PACKAGE_LIST}
|
||||
|
||||
coverage: ## Generate global code coverage report
|
||||
@go test -cover -v -coverpkg=$(PACKAGE_NAME) ${PACKAGE_LIST}
|
||||
@go test -cover -v -coverpkg=$(PACKAGE_NAME)/... ${PACKAGE_LIST}
|
||||
|
||||
dep: ## Get the dependencies
|
||||
@go get -v -d -t ${PACKAGE_LIST}
|
||||
|
||||
clean: ## Remove previous build
|
||||
@rm -f $(PROJECT_NAME)
|
||||
@go get -v -d -t $(PACKAGE_NAME)/...
|
||||
|
||||
help: ## Display this help screen
|
||||
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
Loading…
Reference in New Issue