forked from dezh-tech/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
54 lines (42 loc) · 1.15 KB
/
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
53
54
PACKAGES=$(shell go list ./... | grep -v 'tests' | grep -v 'grpc/gen')
ifneq (,$(filter $(OS),Windows_NT MINGW64))
RM = del /q
else
RM = rm -rf
endif
### Tools needed for development
devtools:
@echo "Installing devtools"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install mvdan.cc/gofumpt@latest
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/bufbuild/buf/cmd/[email protected]
### Testing
unit-test:
go test $(PACKAGES)
test:
go test ./... -covermode=atomic
test-race:
go test ./... --race
### Formatting the code
fmt:
gofumpt -l -w .
go mod tidy
check:
golangci-lint run --timeout=20m0s
### Building
build: swag
go build -o build/panda cmd/main.go
swag:
swag init -g ./deliveries/http/http_handlers.go
### Proto
proto:
$(RM) infrastructure/grpc_client/gen
$(RM) delivery/grpc/gen
cd infrastructure/grpc_client/buf && buf generate --template buf.gen.yaml ../proto
cd delivery/grpc/buf && buf generate --template buf.gen.yaml ../proto
### pre commit
pre-commit: fmt check unit-test
@echo ready to commit...
.PHONY: build