/
Makefile
62 lines (44 loc) · 1.76 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
55
56
57
58
59
60
61
62
.SILENT:
.PHONY:
client_build_version = v.0.0.1-beta
ifeq ($(OS), Windows_NT)
build_date = $(shell date /t)
client_data_secret = $(shell type .\secrets\data)
client_binary_path = ./bin/client.exe
server_binary_path = ./bin/server.exe
else
build_date = $(shell date -I)
client_data_secret = $(shell cat secrets/data)
client_binary_path = ./bin/client
server_binary_path = ./bin/server
endif
client_ldflags = "-X main.buildDate=$(build_date) -X main.buildVersion=$(client_build_version) -X main.dataSecret=$(client_data_secret)"
build-server:
go build -o $(server_binary_path) ./cmd/server/main.go
run-server:
$(server_binary_path)
server: build-server
$(server_binary_path)
build-client:
go build -ldflags $(client_ldflags) -o $(client_binary_path) ./cmd/client/main.go
run-client:
$(client_binary_path)
client: build-client
$(client_binary_path)
test:
go test ./...
coverage:
go test ./... -coverprofile cover.out
go tool cover -html=cover.out
mocks:
mockgen -source=./internal/services/client/user_stored_data.go -destination=./internal/services/client/mocks/user_stored_data.go
mockgen -source=./internal/services/server/user_stored_data.go -destination=./internal/services/server/mocks/user_stored_data.go
mockgen -source=./internal/services/server/user.go -destination=./internal/services/server/mocks/user.go
mockgen -source="./internal/handlers/user.go" -destination="./internal/handlers/mocks/user.go"
mockgen -source="./internal/handlers/user_stored_data.go" -destination="./internal/handlers/mocks/user_stored_data.go"
mockgen -source="./internal/clientsync/base.go" -destination="./internal/clientsync/mocks/base.go"
doc:
swag init --d ./cmd/server,./internal/handlers,./internal/dtos,./pkg/httputils,./internal/domain
fmt:
gofmt -s -w .
goimports -w .