【架构优化】删除 domain.WorkflowDefinition 中无调用方的 GroupMemberIDs/HasGroupMember 死代码

未关闭
#408 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@fx-kurumi 已经在做这个了。

开始于 2026年11月13日。

  • #409 来自 @fx-kurumi —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
18/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
停滞
技术栈
go
领域
backend

调研方向

The two dead methods, GroupMemberIDs and HasGroupMember, live in internal/domain/workflow.go; run grep -rn "HasGroupMember\|GroupMemberIDs" first to confirm there are no callers. Keep the GroupMembers field and its JSON tag, since engine/run_start.go uses it. Done when both methods are removed and go build ./... and go test ./internal/domain/ ./internal/engine/ pass. A linked pull request (#409) is already open, so check it before starting.

由索引模型根据 Issue 内容生成。

描述

现状问题

internal/domain/workflow.go 中 WorkflowDefinition 的两个方法没有任何调用方:

  • HasGroupMember(id string) bool:全仓库 0 处调用(含测试);
  • GroupMemberIDs() []string:唯一调用方就是 HasGroupMember。

二者位于 internal/ 包,仓库外无法引用,属于死代码;同时 HasGroupMember 里还有一段可被 slices.Contains 替代的手写查找循环,留着会误导读者以为群组成员判断仍走这里。

重构方案

  • 删除 WorkflowDefinition.GroupMemberIDs 与 WorkflowDefinition.HasGroupMember 两个方法(共约 24 行)。
  • 保留 GroupMembers 字段及其 JSON 标签 groupMembers 不动(持久化/接口契约),engine/run_start.go 对该字段的使用不受影响。

影响范围

仅 internal/domain/workflow.go;无调用方,对外接口与运行行为不变。

验证方式

  • grep -rn "HasGroupMember\|GroupMemberIDs" 确认无残留引用;
  • gofmt、go vet ./internal/...、go build ./...、go test ./internal/domain/ ./internal/engine/ 通过。
主要语言
Go
星标
141
派生
28
平均合并
1 天 15 小时
30 天内合并 PR
113

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Tencent/LoopForge 的其他 Issue

查看 Tencent/LoopForge 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。