-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (42 loc) · 933 Bytes
/
Makefile
File metadata and controls
54 lines (42 loc) · 933 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Makefile
.PHONY: build test lint clean install run
# Variables
BINARY_NAME=dev-cleaner
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS=-ldflags "-s -w -X main.version=$(VERSION)"
# Build
build:
go build $(LDFLAGS) -o $(BINARY_NAME) .
# Install locally
install: build
cp $(BINARY_NAME) /usr/local/bin/
# Run tests
test:
go test -v ./...
# Run tests with coverage
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report: coverage.html"
# Run linter
lint:
golangci-lint run
# Format code
fmt:
go fmt ./...
# Vet code
vet:
go vet ./...
# Clean build artifacts
clean:
rm -f $(BINARY_NAME)
rm -f coverage.out coverage.html
# Run the tool
run:
go run . $(ARGS)
# All checks before commit
check: fmt vet test
@echo "✅ All checks passed!"
# Quick scan (dev helper)
scan: build
./$(BINARY_NAME) scan