-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (31 loc) · 999 Bytes
/
Makefile
File metadata and controls
39 lines (31 loc) · 999 Bytes
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
37
38
39
GO_FILES := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
BUILD_DIR := build
_build:
@mkdir -p ${BUILD_DIR}
.PHONY: clean
clean:
@go clean -i ./...
generate:
@echo "Generating code..."
@go generate ./...
$(BUILD_DIR)/coverage.out: _build $(GO_FILES)
@go test -cover -race -coverprofile $(BUILD_DIR)/coverage.out.tmp -timeout 300s ./...
@cat $(BUILD_DIR)/coverage.out.tmp | grep -v '.pb.go' | grep -v 'mock_' > $(BUILD_DIR)/coverage.out
@rm $(BUILD_DIR)/coverage.out.tmp
.PHONY: lint
lint:
ifeq (, $(shell which golangci-lint))
@echo "Install golangci-lint..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3
endif
@echo "lint..."
@golangci-lint run --timeout=300s ./...
.PHONY: test
test: $(BUILD_DIR)/coverage.out
.PHONY: coverage
coverage: $(BUILD_DIR)/coverage.out
@echo ""
@go tool cover -func ./$(BUILD_DIR)/coverage.out
.PHONY: coverage-html
coverage-html: $(BUILD_DIR)/coverage.out
@go tool cover -html ./$(BUILD_DIR)/coverage.out