forked from bnb-chain/bep3-deputy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (32 loc) · 1.28 KB
/
Makefile
File metadata and controls
39 lines (32 loc) · 1.28 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
BUILD_TAGS = netgo
PACKAGES=$(shell go list ./...)
build:
ifeq ($(OS),Windows_NT)
go build $(BUILD_FLAGS) -o build/deputy.exe main.go
else
go build $(BUILD_FLAGS) -o build/deputy main.go
endif
test:
make set_with_deadlock
make test_unit
make cleanup_after_test_with_deadlock
test_unit:
@echo "--> go test "
@go test -race $(PACKAGES)
# uses https://github.com/sasha-s/go-deadlock/ to detect potential deadlocks
set_with_deadlock:
find . -name "*.go" | xargs -n 1 sed -i.mutex_bak 's/sync.RWMutex/deadlock.RWMutex/'
find . -name "*.go" | xargs -n 1 sed -i.mutex_bak 's/sync.Mutex/deadlock.Mutex/'
go mod download
find . -name "*.go" | xargs -n 1 goimports -w
# cleanes up after you ran test_with_deadlock
cleanup_after_test_with_deadlock:
find . -name "*.go" | xargs -n 1 sed -i.mutex_bak 's/deadlock.RWMutex/sync.RWMutex/'
find . -name "*.go" | xargs -n 1 sed -i.mutex_bak 's/deadlock.Mutex/sync.Mutex/'
find . -name "*.go" | xargs -n 1 goimports -w
find . -name "*.go.mutex_bak" | xargs rm
update_mock_executor:
go get github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen
$(shell mockgen -source=common/executor.go -package mock > executor/mock/mock_executor.go)
.PHONY: build test test_unit set_with_deadlock cleanup_after_test_with_deadlock update_mock_executor