-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
52 lines (41 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
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/protoc-gen-go@v1.35
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5
go install github.com/pactus-project/protoc-gen-doc/cmd/protoc-gen-doc@v0.0.0-20240815105130-84e89d0170e4
go install github.com/bufbuild/buf/cmd/buf@v1.47
### 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:
go build -o build/immortal cmd/main.go
### Proto
proto:
$(RM) client/gen
$(RM) server/grpc/gen
cd client/buf && buf generate --template buf.gen.yaml ../proto
cd server/grpc/buf && buf generate --template buf.gen.yaml ../proto
### pre commit
pre-commit: fmt check unit-test
@echo ready to commit...
.PHONY: build