-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (46 loc) · 1.27 KB
/
Makefile
File metadata and controls
57 lines (46 loc) · 1.27 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
.PHONY: test bench lint fmt vet clean help build install
# Default target
all: test
# Build the CLI tool
build:
go build -o bin/porter ./cmd/porter
# Install the CLI tool to $GOPATH/bin
install:
go install ./cmd/porter
# Run tests
test:
go test -v ./...
# Run tests with coverage
coverage:
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Run benchmarks
bench:
go test -bench=. -benchmem ./...
# Format code
fmt:
gofmt -s -w .
# Run go vet
vet:
go vet ./...
# Run linter (requires golangci-lint)
lint:
@which golangci-lint > /dev/null || (echo "golangci-lint not installed. Install: https://golangci-lint.run/usage/install/" && exit 1)
golangci-lint run
# Clean build artifacts
clean:
go clean
rm -f coverage.out coverage.html
rm -rf bin/
# Show help
help:
@echo "Available targets:"
@echo " make build - Build the CLI tool to bin/porter"
@echo " make install - Install CLI tool to \$$GOPATH/bin"
@echo " make test - Run tests"
@echo " make coverage - Run tests with coverage report"
@echo " make bench - Run benchmarks"
@echo " make fmt - Format code with gofmt"
@echo " make vet - Run go vet"
@echo " make lint - Run golangci-lint"
@echo " make clean - Clean build artifacts"