Naveen Sampath | 04696f7 | 2022-06-13 15:19:14 +0530 | [diff] [blame^] | 1 | PACKAGE_DIRS := $(shell find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | sort) |
| 2 | |
| 3 | test: 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 | |
| 10 | testdeps: testdata/redis/src/redis-server |
| 11 | |
| 12 | bench: testdeps |
| 13 | go test ./... -test.run=NONE -test.bench=. -test.benchmem |
| 14 | |
| 15 | .PHONY: all test testdeps bench |
| 16 | |
| 17 | testdata/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 | |
| 21 | testdata/redis/src/redis-server: testdata/redis |
| 22 | cd $< && make all |
| 23 | |
| 24 | fmt: |
| 25 | gofmt -w -s ./ |
| 26 | goimports -w -local github.com/go-redis/redis ./ |
| 27 | |
| 28 | go_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 |