Alanxtl opened a new issue, #3691:
URL: https://github.com/apache/dubbo-go/issues/3691

   ## 背景
   
   当前 dubbo-go 仍直接依赖部分 gost 的标准库薄封装,以及 go.uber.org/atomic、github.com/pkg/errors 
等可以逐步回归标准库的能力。建议先迁移 dubbo-go 的实际调用方,再考虑在 gost 中保留一个兼容周期,避免一次性破坏外部用户。
   
   ## 建议替换范围
   
   | 当前依赖 | 建议目标 | 备注 |
   | --- | --- | --- |
   | gost/time | time.After / time.NewTimer | getty 当前主要使用超时等待;确认不需要时间轮后直接替换 |
   | gost/sort | slices.Sort / sort.Slice | Prioritizer 属于 Dubbo 领域接口,应移动到本地业务包 
|
   | gost/strings | strings / regexp / reflect | RegSplit、IsNil 可分别回归标准库 |
   | gost/net | net、net.ListenTCP、本地小型 helper | 仅保留 Dubbo 真正需要的网络逻辑 |
   | gost/path/filepath | os.Stat、io/fs | 清理无实际调用的薄封装 |
   | gost/runtime.GoSafely | dubbo-go/internal 中的最小 helper,或调用处显式实现 | 保留现有 
recover、WaitGroup 语义 |
   | go.uber.org/atomic | sync/atomic 的 typed atomic 类型 | 例如 
atomic.Int64、atomic.Bool |
   | github.com/pkg/errors | errors、fmt.Errorf("%w") | 确认并保留 errors.Is/As 
语义;堆栈信息需单独评估 |
   
   ## 实施要求
   
   1. 先修改 dubbo-go 的生产代码调用方,避免在同一个 PR 里立即删除 gost 公共包。
   2. 对 Prioritizer、Pager 等业务接口,迁移到 dubbo-go 合适的领域包。
   3. 对 github.com/pkg/errors,逐步替换 New、Errorf、Wrap、WithMessage,不要无检查地丢失错误链或堆栈信息。
   4. 清理完成后,再对 gost 包增加 deprecation 说明,并评估后续删除。
   5. 不在本 issue 中替换 container/set、无界 channel、TaskPool、observer 或 
logger;这些不是标准库的直接等价物。
   
   ## 验收标准
   
   - 生产代码不再新增上述薄封装的直接调用。
   - go test ./... 通过。
   - getty、registry、config center、metadata、remoting 相关测试通过。
   - 对超时、错误链、recover、排序结果做回归测试。
   - 记录仍需保留的兼容层及其删除计划。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to