chore(arch): forbid viper and mapstructure inside the micro-kernel

配置装载实现必须留在 plugins/infra/config 适配器里,内核只依赖
ConfigSource 抽象;把 viper 与 mapstructure 加入 1.1 禁止清单,防止配置
装载依赖重新渗回 core(已用临时探针文件反向验证检查生效)。
This commit is contained in:
ryan
2026-08-29 10:17:57 +08:00
parent 8bd59511a8
commit b43c429544
+3 -3
View File
@@ -53,12 +53,12 @@ echo -e "${BOLD}═════════════════════
# ==============================================================================
log_check "1. 检查微内核 (backend/core/) 纯洁度..."
# 1.1 禁止直接依赖重型 Web/ORM/Worker 框架
CORE_FRAMEWORK_IMPORTS=$(rg -n '"github.com/gin-gonic/gin"|"gorm.io/gorm"|"github.com/hibiken/asynq"|"github.com/robfig/cron' \
# 1.1 禁止直接依赖重型 Web/ORM/Worker/Config 框架
CORE_FRAMEWORK_IMPORTS=$(rg -n '"github.com/gin-gonic/gin"|"gorm.io/gorm"|"github.com/hibiken/asynq"|"github.com/robfig/cron|"github.com/spf13/viper"|"github.com/mitchellh/mapstructure"' \
"${BACKEND_DIR}/core/" --glob '*.go' -g '!*contracts*' -g '!*_test.go' || true)
if [ -n "${CORE_FRAMEWORK_IMPORTS}" ]; then
log_fail "backend/core/ 严禁导入具体 Web/ORM/Worker 运行时框架 (gin, gorm, asynq, cron):"
log_fail "backend/core/ 严禁导入具体 Web/ORM/Worker/Config 运行时框架 (gin, gorm, asynq, cron, viper, mapstructure):"
echo "${CORE_FRAMEWORK_IMPORTS}" >&2
else
log_pass "backend/core/ 无重型框架依赖"