-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (43 loc) · 945 Bytes
/
Makefile
File metadata and controls
55 lines (43 loc) · 945 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
55
.PHONY: build test test-coverage lint run clean fmt vet tidy tools check
# Variables
BINARY_NAME=sfu
BINARY_DIR=bin
CMD_DIR=cmd/sfu
COVERAGE_FILE=coverage.out
# Build
build:
@mkdir -p $(BINARY_DIR)
go build -o $(BINARY_DIR)/$(BINARY_NAME) ./$(CMD_DIR)
# Run
run: build
./$(BINARY_DIR)/$(BINARY_NAME)
# Test
test:
go test -v -race ./...
# Test with coverage
test-coverage:
go test -v -race -coverprofile=$(COVERAGE_FILE) -covermode=atomic ./...
go tool cover -html=$(COVERAGE_FILE) -o coverage.html
# Lint (requires golangci-lint)
lint:
golangci-lint run ./...
# Format
fmt:
go fmt ./...
goimports -w .
# Vet
vet:
go vet ./...
# Tidy
tidy:
go mod tidy
# Clean
clean:
rm -rf $(BINARY_DIR)
rm -f $(COVERAGE_FILE) coverage.html
# Install development tools
tools:
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# All checks
check: fmt vet lint test