-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (40 loc) · 975 Bytes
/
Makefile
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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
# Linting
GOLINT=golangci-lint
AIR=air
all: lint test benchmark
air:
$(AIR) -c .air.toml
test:
$(GOTEST) -v -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
benchmark:
$(GOTEST) -v -bench=. -benchmem ./...
lint:
$(GOLINT) run
clean:
$(GOCLEAN)
rm -f coverage.out
rm -f coverage.html
run:
docker compose up --build
api-docs:
@if ! swag fmt -g ./main.go; then \
echo "Error: Failed to format API docs"; \
exit 1; \
fi
@if ! swag init --parseDependency -g ./main.go -o ./api; then \
echo "Error: Failed to generate API docs"; \
exit 1; \
fi
deps:
$(GOGET) -v -d ./...
go install github.com/cosmtrek/air@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/swaggo/swag/cmd/swag@latest
.PHONY: all air test benchmark lint clean run api-docs deps