-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (58 loc) · 1.67 KB
/
Makefile
File metadata and controls
68 lines (58 loc) · 1.67 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
64
65
66
67
68
# -----------------------------
# Makefile for Go Crypto/Security Library
# -----------------------------
# Location where Go binaries are installed
TOOLS_BIN := $(shell go env GOPATH)/bin
.PHONY: tools fmt vet lint security test ci
# -----------------------------
# Install required dev tools
# -----------------------------
tools:
@echo "Installing development tools..."
@go install honnef.co/go/tools/cmd/staticcheck@latest
@go install golang.org/x/vuln/cmd/govulncheck@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install golang.org/x/tools/cmd/goimports@latest
@echo "All tools installed."
# -----------------------------
# Formatting
# -----------------------------
fmt: tools
@echo "Running gofmt..."
gofmt -w .
@echo "Running goimports..."
goimports -w .
# -----------------------------
# Build
# -----------------------------
build:
@echo "Building all packages..."
go build ./...
# -----------------------------
# Static analysis
# -----------------------------
vet: tools
@echo "Running go vet..."
go vet ./...
lint: tools
@echo "Running staticcheck..."
staticcheck ./...
@echo "Running golangci-lint..."
golangci-lint run
# -----------------------------
# Security checks
# -----------------------------
security: tools
@echo "Running govulncheck..."
govulncheck ./...
# -----------------------------
# Tests
# -----------------------------
test: tools
@echo "Running tests with race detector and coverage..."
go test -race -coverprofile=coverage.out -covermode=atomic ./...
# -----------------------------
# Full CI run (all checks)
# -----------------------------
ci: fmt build vet lint security test
@echo "All checks passed."