-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
56 lines (43 loc) · 1.48 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
BINARIES=redis-proxy switch-test
all: $(BINARIES)
########################################
# redis-proxy and related targets
redis-proxy: rproxy/*.go cmd/redis-proxy/*.go
./scripts/go build -o "$@" github.com/Codility/redis-proxy/cmd/redis-proxy
.PHONY: clean
clean:
rm -rf $(BINARIES) .gopath
.PHONY: config
config: config.json
config.json:
echo "Create config.json based on config_example.json"
exit 1
.PHONY: run
run: redis-proxy config.json
./redis-proxy config.json
.PHONY: test
test: goimports govet
./scripts/go test -v github.com/Codility/redis-proxy/fakeredis/
./scripts/go test -v github.com/Codility/redis-proxy/resp/
./scripts/go test -v github.com/Codility/redis-proxy/rproxy/
.PHONY: govet
govet:
find . -name '*.go' -and -not -path './vendor/*' -and -not -path './.gopath/*' | \
while read f; do echo `dirname "$$f"`; done | uniq | xargs ./scripts/go vet
.PHONY: goimports
goimports:
./scripts/go get golang.org/x/tools/cmd/goimports
@echo "Running goimports..."
@output=$$(find . -name '*.go' -and -not -path './vendor/*' -and -not -path './.gopath/*' | xargs ./.gopath/bin/goimports -d) && \
if ! [ -z "$$output" ]; then \
echo "$$output"; \
echo "goimports failed!"; \
exit 1; \
fi
@echo "goimports passed"
########################################
# switch-test and related targets
switch-test: redis-proxy cmd/switch-test/*.go
./scripts/go build -o "$@" github.com/Codility/redis-proxy/cmd/switch-test
run-switch-test: switch-test redis-proxy
./switch-test