77 docker-mysql-test-with-monitoring docker-postgres-test-with-monitoring docker-sqlite-test-with-monitoring docker-redis-test-with-monitoring docker-all-tests-with-monitoring \
88 deps deps-update \
99 monitoring monitoring-foreground monitoring-stop monitoring-status monitoring-logs monitoring-cleanup \
10- dev-setup fmt lint clean clean-all benchmark docs ci release-check docker-build docker-test quick-test full-test dev info cover
10+ dev-setup fmt lint clean clean-all benchmark docs docs-check ci release-check docker-build docker-test quick-test full-test dev info cover
1111
1212# 默认目标
1313help : # # 显示帮助信息
@@ -68,6 +68,7 @@ help: ## 显示帮助信息
6868 @echo " ℹ️ 其他:"
6969 @echo " \033[36mdev-setup\033[0m 设置开发环境"
7070 @echo " \033[36mdocs\033[0m 生成/预览文档"
71+ @echo " \033[36mdocs-check\033[0m 检查关键文档是否引用过期 API/指标"
7172 @echo " \033[36minfo\033[0m 显示项目信息"
7273
7374# 构建相关
@@ -209,11 +210,14 @@ fmt: ## 格式化代码
209210
210211lint : # # 运行代码检查
211212 @echo " 🔍 运行代码检查..."
212- @if command -v golangci-lint > /dev/null 2>&1 ; then \
213+ @LINTER=" $$ (go env GOPATH)/bin/golangci-lint" ; \
214+ if [ -x " $$ LINTER" ]; then \
215+ " $$ LINTER" run; \
216+ elif command -v golangci-lint > /dev/null 2>&1 ; then \
213217 golangci-lint run; \
214218 else \
215219 echo " ⚠️ golangci-lint 未安装,跳过代码检查" ; \
216- echo " 💡 安装方法: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest" ; \
220+ echo " 💡 安装方法: go install github.com/golangci/golangci-lint/v2/ cmd/golangci-lint@latest" ; \
217221 fi
218222
219223# 清理相关
@@ -242,12 +246,17 @@ docs: ## 生成文档
242246 echo " 💡 安装方法: go install golang.org/x/tools/cmd/godoc@latest" ; \
243247 fi
244248
249+ docs-check : # # 检查关键文档与当前 API/指标契约是否一致
250+ @echo " 📘 检查关键文档一致性..."
251+ @chmod +x ./scripts/check-doc-consistency.sh
252+ @./scripts/check-doc-consistency.sh
253+
245254# CI/CD 相关
246- ci : deps fmt lint test test-race # # CI 流程(依赖安装 + 格式化 + 代码检查 + 测试)
255+ ci : deps fmt lint docs-check test test-race # # CI 流程(依赖安装 + 格式化 + 文档检查 + 代码检查 + 测试)
247256 @echo " 🚀 CI 流程完成 - 所有检查通过"
248257
249258# 发布相关
250- release-check : lint test # # 发布前检查
259+ release-check : docs-check lint test # # 发布前检查
251260 @echo " 🔍 发布前检查..."
252261 @echo " ✅ 测试通过"
253262 @echo " ✅ 代码检查通过"
@@ -263,10 +272,10 @@ docker-test: ## 在 Docker 中运行测试
263272 docker run --rm -v $(PWD ) :/app -w /app golang:1.21 make test
264273
265274# 快捷命令组合
266- quick-test : fmt test # # 快速测试(格式化 + 单元测试)
275+ quick-test : fmt docs-check test # # 快速测试(格式化 + 文档检查 + 单元测试)
267276 @echo " ⚡ 快速测试完成"
268277
269- full-test : fmt test test-race test-integration # # 完整测试套件
278+ full-test : fmt docs-check test test-race test-integration # # 完整测试套件
270279 @echo " 🎉 完整测试套件完成"
271280
272281dev : monitoring test-integration-with-monitoring # # 开发模式(启动监控 + 集成测试)
@@ -283,4 +292,4 @@ info: ## 显示项目信息
283292 @echo " 📊 监控地址:"
284293 @echo " Grafana: http://localhost:3000 (admin/admin)"
285294 @echo " Prometheus: http://localhost:9091"
286- @echo " 指标端点: http://localhost:9090/metrics"
295+ @echo " 指标端点: http://localhost:9090/metrics"
0 commit comments