2023-02-01 10:46:59 +03:00
|
|
|
GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
|
2021-09-23 16:31:21 +03:00
|
|
|
|
2021-03-23 11:28:25 +03:00
|
|
|
test: testdeps
|
2024-03-21 11:48:31 +03:00
|
|
|
$(eval GO_VERSION := $(shell go version | cut -d " " -f 3 | cut -d. -f2))
|
2023-01-30 10:52:13 +03:00
|
|
|
set -e; for dir in $(GO_MOD_DIRS); do \
|
2024-03-21 11:48:31 +03:00
|
|
|
if echo "$${dir}" | grep -q "./example" && [ "$(GO_VERSION)" = "19" ]; then \
|
|
|
|
echo "Skipping go test in $${dir} due to Go version 1.19 and dir contains ./example"; \
|
|
|
|
continue; \
|
|
|
|
fi; \
|
2023-01-30 10:52:13 +03:00
|
|
|
echo "go test in $${dir}"; \
|
|
|
|
(cd "$${dir}" && \
|
2023-02-08 14:52:04 +03:00
|
|
|
go mod tidy -compat=1.18 && \
|
2023-01-30 10:52:13 +03:00
|
|
|
go test && \
|
2023-01-30 11:02:16 +03:00
|
|
|
go test ./... -short -race && \
|
|
|
|
go test ./... -run=NONE -bench=. -benchmem && \
|
2023-01-30 10:52:13 +03:00
|
|
|
env GOOS=linux GOARCH=386 go test && \
|
2024-09-03 17:09:47 +03:00
|
|
|
go test -coverprofile=coverage.txt -covermode=atomic ./... && \
|
2023-01-30 10:52:13 +03:00
|
|
|
go vet); \
|
|
|
|
done
|
2022-08-08 08:40:51 +03:00
|
|
|
cd internal/customvet && go build .
|
|
|
|
go vet -vettool ./internal/customvet/customvet
|
2015-01-24 15:12:48 +03:00
|
|
|
|
2016-03-12 13:25:59 +03:00
|
|
|
testdeps: testdata/redis/src/redis-server
|
2015-01-24 15:12:48 +03:00
|
|
|
|
2016-03-12 13:38:52 +03:00
|
|
|
bench: testdeps
|
|
|
|
go test ./... -test.run=NONE -test.bench=. -test.benchmem
|
|
|
|
|
2023-09-20 14:03:44 +03:00
|
|
|
.PHONY: all test testdeps bench fmt
|
2015-01-24 15:12:48 +03:00
|
|
|
|
2023-09-20 16:08:24 +03:00
|
|
|
build:
|
|
|
|
go build .
|
|
|
|
|
2016-03-12 13:25:59 +03:00
|
|
|
testdata/redis:
|
2015-01-24 15:12:48 +03:00
|
|
|
mkdir -p $@
|
2024-07-10 18:30:32 +03:00
|
|
|
wget -qO- https://download.redis.io/releases/redis-7.4-rc2.tar.gz | tar xvz --strip-components=1 -C $@
|
2015-01-24 15:12:48 +03:00
|
|
|
|
2016-03-12 13:25:59 +03:00
|
|
|
testdata/redis/src/redis-server: testdata/redis
|
2015-01-24 15:12:48 +03:00
|
|
|
cd $< && make all
|
2020-11-21 11:18:39 +03:00
|
|
|
|
2021-09-08 16:00:52 +03:00
|
|
|
fmt:
|
2023-09-20 14:03:44 +03:00
|
|
|
gofumpt -w ./
|
2023-01-23 09:48:54 +03:00
|
|
|
goimports -w -local github.com/redis/go-redis ./
|
2021-09-23 16:31:21 +03:00
|
|
|
|
|
|
|
go_mod_tidy:
|
2023-01-30 10:52:13 +03:00
|
|
|
set -e; for dir in $(GO_MOD_DIRS); do \
|
2021-09-23 16:31:21 +03:00
|
|
|
echo "go mod tidy in $${dir}"; \
|
|
|
|
(cd "$${dir}" && \
|
2022-06-04 15:15:43 +03:00
|
|
|
go get -u ./... && \
|
2023-01-23 09:48:54 +03:00
|
|
|
go mod tidy -compat=1.18); \
|
2021-09-23 16:31:21 +03:00
|
|
|
done
|