2023-04-11 21:13:29 +08:00
|
|
|
SHELL := /bin/bash
|
2022-05-10 15:38:08 +08:00
|
|
|
|
|
|
|
.PHONY: tidy
|
|
|
|
tidy:
|
|
|
|
$(eval files=$(shell find . -name go.mod))
|
|
|
|
@set -e; \
|
|
|
|
for file in ${files}; do \
|
|
|
|
goModPath=$$(dirname $$file); \
|
|
|
|
cd $$goModPath; \
|
|
|
|
go mod tidy; \
|
|
|
|
cd -; \
|
|
|
|
done
|
|
|
|
|
2022-11-01 20:12:21 +08:00
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
2023-03-28 09:25:29 +08:00
|
|
|
golangci-lint run
|
|
|
|
|
|
|
|
gftidy:
|
|
|
|
$(eval files=$(shell find . -name go.mod))
|
|
|
|
@set -e; \
|
2023-04-11 21:13:29 +08:00
|
|
|
# GITHUB_REF_NAME=v2.4.0; \
|
|
|
|
if [[ $$GITHUB_REF_NAME =~ "v" ]]; then \
|
|
|
|
latestVersion=$$GITHUB_REF_NAME; \
|
|
|
|
else \
|
|
|
|
latestVersion=latest; \
|
|
|
|
fi; \
|
2023-03-28 09:25:29 +08:00
|
|
|
for file in ${files}; do \
|
|
|
|
goModPath=$$(dirname $$file); \
|
2023-04-11 21:13:29 +08:00
|
|
|
if [[ $$goModPath =~ "./contrib" || $$goModPath =~ "./cmd/gf" || $$goModPath =~ "./example" ]]; then \
|
|
|
|
echo ""; \
|
|
|
|
echo "processing dir: $$goModPath"; \
|
|
|
|
# Do not modify the order of any of the following sentences \
|
2023-03-28 09:25:29 +08:00
|
|
|
cd $$goModPath; \
|
2023-04-11 21:13:29 +08:00
|
|
|
go mod tidy; \
|
|
|
|
go list -f "{{if and (not .Indirect) (not .Main)}}{{.Path}}@$$latestVersion{{end}}" -m all | grep "^github.com/gogf/gf/contrib" | xargs -L1 go get -v; \
|
|
|
|
go get -v github.com/gogf/gf/v2@$$latestVersion; \
|
2023-03-28 09:25:29 +08:00
|
|
|
go mod tidy; \
|
|
|
|
cd -; \
|
|
|
|
fi \
|
|
|
|
done
|