-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (40 loc) · 734 Bytes
/
Copy pathMakefile
File metadata and controls
52 lines (40 loc) · 734 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
.PHONY: build run test vet fmt clean install
# Build variables
BINARY_NAME=traverse
BUILD_DIR=./bin
# Go variables
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
GOFMT=gofmt
GOINSTALL=$(GOCMD) install
# Build the binary
build:
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) .
# Run the application
run: build
$(BUILD_DIR)/$(BINARY_NAME)
# Run tests
test:
$(GOTEST) -v ./...
# Run tests with coverage
test-cover:
$(GOTEST) -cover ./...
# Run linter
vet:
$(GOVET) ./...
# Format code
fmt:
$(GOFMT) -w .
# Clean build artifacts
clean:
$(GOCMD) clean
go clean -testcache
# Install globally
install:
$(GOINSTALL) .
# Development: format, vet, test
dev: fmt vet test
# CI: vet and test
ci: vet test