2022-01-18 22:28:46 +08:00
|
|
|
PACKAGE_DIRS := $(shell find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | sort)
|
|
|
|
|
2021-05-21 02:53:56 +08:00
|
|
|
test: testdeps
|
2018-09-05 04:19:43 +08:00
|
|
|
go test ./...
|
|
|
|
go test ./... -short -race
|
2021-05-21 02:53:56 +08:00
|
|
|
go test ./... -run=NONE -bench=. -benchmem
|
2018-09-05 04:19:43 +08:00
|
|
|
env GOOS=linux GOARCH=386 go test ./...
|
|
|
|
go vet
|
|
|
|
|
|
|
|
testdeps: testdata/redis/src/redis-server
|
|
|
|
|
|
|
|
bench: testdeps
|
|
|
|
go test ./... -test.run=NONE -test.bench=. -test.benchmem
|
|
|
|
|
|
|
|
.PHONY: all test testdeps bench
|
|
|
|
|
|
|
|
testdata/redis:
|
|
|
|
mkdir -p $@
|
2021-08-24 19:41:57 +08:00
|
|
|
wget -qO- https://download.redis.io/releases/redis-6.2.5.tar.gz | tar xvz --strip-components=1 -C $@
|
2018-09-05 04:19:43 +08:00
|
|
|
|
|
|
|
testdata/redis/src/redis-server: testdata/redis
|
|
|
|
cd $< && make all
|
2021-05-21 02:53:56 +08:00
|
|
|
|
2022-01-18 22:28:46 +08:00
|
|
|
fmt:
|
|
|
|
gofmt -w -s ./
|
|
|
|
goimports -w -local github.com/go-redis/redis ./
|
|
|
|
|
|
|
|
go_mod_tidy:
|
|
|
|
go get -u && go mod tidy
|
|
|
|
set -e; for dir in $(PACKAGE_DIRS); do \
|
|
|
|
echo "go mod tidy in $${dir}"; \
|
|
|
|
(cd "$${dir}" && \
|
|
|
|
go get -u && \
|
|
|
|
go mod tidy); \
|
|
|
|
done
|