-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (25 loc) · 896 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
GO := go
ifdef GO_BIN
GO = $(GO_BIN)
endif
GOLANGCI_LINT_VERSION := v1.18.0
BIN_DIR := $(GOPATH)/bin
all: test lint
tidy:
$(GO) mod tidy -v
fmt:
gofmt -s -w .
build:
$(GO) build ./...
ci-build:
$(GO) build -v -ldflags '-X $(VERSION_PACKAGE).GitHash=$(GIT_COMMIT) -X $(VERSION_PACKAGE).GitTag=$(GIT_TAG) -X $(VERSION_PACKAGE).GitBranch=$(GIT_BRANCH) -X $(VERSION_PACKAGE).BuildTime=$(BUILD_TIME) -X $(VERSION_PACKAGE).GitCommitMessage=$(GIT_COMMIT_MESSAGE)'
test: build
$(GO) test -cover -race -v ./...
test-coverage:
$(GO) test ./... -race -coverprofile=.testCoverage.txt && $(GO) tool cover -html=.testCoverage.txt
ci-test: ci-build
$(GO) test -race $$($(GO) list ./...) -v -coverprofile .testCoverage.txt
lint: $(GOLANGCI_LINT)
golangci-lint run --fast
$(GOLANGCI_LINT):
GO111MODULE=on $(GO) get github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)