blob: a4cfe0576e68c3485c7038c4af7debab5c0276cf [file] [log] [blame]
Naveen Sampath04696f72022-06-13 15:19:14 +05301PACKAGE_DIRS := $(shell find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | sort)
2
3test: testdeps
4 go test ./...
5 go test ./... -short -race
6 go test ./... -run=NONE -bench=. -benchmem
7 env GOOS=linux GOARCH=386 go test ./...
8 go vet
9
10testdeps: testdata/redis/src/redis-server
11
12bench: testdeps
13 go test ./... -test.run=NONE -test.bench=. -test.benchmem
14
15.PHONY: all test testdeps bench
16
17testdata/redis:
18 mkdir -p $@
19 wget -qO- https://download.redis.io/releases/redis-6.2.5.tar.gz | tar xvz --strip-components=1 -C $@
20
21testdata/redis/src/redis-server: testdata/redis
22 cd $< && make all
23
24fmt:
25 gofmt -w -s ./
26 goimports -w -local github.com/go-redis/redis ./
27
28go_mod_tidy:
29 go get -u && go mod tidy
30 set -e; for dir in $(PACKAGE_DIRS); do \
31 echo "go mod tidy in $${dir}"; \
32 (cd "$${dir}" && \
33 go get -u && \
34 go mod tidy); \
35 done