-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (48 loc) · 1.4 KB
/
Makefile
File metadata and controls
63 lines (48 loc) · 1.4 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SHELL := /bin/bash
GO ?= go
TOOLS := golangci-lint gosec govulncheck
GOLANGCI_LINT_VERSION ?= latest
GOSEC_VERSION ?= latest
GOVULNCHECK_VERSION ?= latest
.PHONY: help test test-race lint gosec vuln tidy fmt tools clean finalize
help: ## Show help
@awk 'BEGIN {FS=":.*## "}; \
/^[a-zA-Z0-9_.-]+:.*## / { \
if (match($$0, /## .*## /)) { \
printf "error: multiple ## in help comment for target %s\n", $$1; exit 1; \
} \
printf " %-14s %s\n", $$1, $$2 \
}' $(MAKEFILE_LIST)
build: ## Build the binary
mkdir -p bin
go build -o bin/$(BINARY) ./cmd/weaver
tools: ## Install lint/vuln tools
@$(GO) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
@$(GO) install github.com/securego/gosec/v2/cmd/gosec@$(GOSEC_VERSION)
@$(GO) install golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
fmt: ## Run gofmt
$(GO) fmt ./...
lint: tools ## Run golangci-lint
golangci-lint run ./...
vuln: tools ## Run govulncheck
govulncheck ./...
gosec: tools ## Run gosec
gosec ./...
tidy: ## Run go mod tidy
$(GO) mod tidy
test: ## Run unit tests
$(GO) test ./...
test-race: ## Run unit tests with race detector
$(GO) test ./... -race -count=1
clean: ## Clean test cache
@$(GO) clean -testcache
finalize: ## Run every quality assurance tool
$(MAKE) tools
$(MAKE) fmt
$(MAKE) lint
$(MAKE) vuln
$(MAKE) gosec
$(MAKE) tidy
$(MAKE) test
$(MAKE) test-race
$(MAKE) clean