-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (65 loc) · 1.63 KB
/
Makefile
File metadata and controls
81 lines (65 loc) · 1.63 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
69
70
71
72
73
74
75
76
77
78
79
80
81
# Makefile for passforge project
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOLINT=golangci-lint
GOIMPORTS=goimports
# Binary name
BINARY_NAME=passforge
# Build directory
BUILD_DIR=build
# Main package path
MAIN_PACKAGE=.
.PHONY: all build test clean lint deps help goimports
all: test goimports fmt build
# Build the project
build:
mkdir -p $(BUILD_DIR)
$(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PACKAGE)
# Run tests
test:
$(GOTEST) -v ./...
# Run tests with coverage
test-coverage:
$(GOTEST) -v -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
# Clean build artifacts
clean:
$(GOCLEAN)
rm -rf $(BUILD_DIR)
rm -f coverage.out coverage.html
# Install dependencies
deps:
$(GOMOD) download
$(GOMOD) tidy
# Run linter
lint:
$(GOLINT) run
# Format code
fmt:
$(GOCMD) fmt ./...
# Run goimports
goimports:
@which $(GOIMPORTS) > /dev/null || go install golang.org/x/tools/cmd/goimports@latest
$(GOIMPORTS) -w ./
# Verify dependencies
verify:
$(GOMOD) verify
# Show help
help:
@echo "Make targets:"
@echo " all - Run tests and build"
@echo " build - Build the binary"
@echo " test - Run tests"
@echo " test-coverage - Run tests with coverage report"
@echo " clean - Clean build artifacts"
@echo " deps - Install dependencies"
@echo " lint - Run linter"
@echo " fmt - Format code"
@echo " goimports - Run goimports to format code and update imports"
@echo " verify - Verify dependencies"
@echo " help - Show this help"