Makefile 858 B

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