xxs588 opened a new pull request, #1111:
URL: https://github.com/apache/dubbo-go-samples/pull/1111

   ## 概述
   
   修复 `task/shop` 商城 demo 中导致灰度路由(tag routing)无法工作的 3 个代码问题。
   
   ## 修复内容
   
   ### 修复 1:CheckItem/CheckItemGray 语义反转
   
   `frontend/server_v1/server.go` 中 `CheckItem` 和 `CheckItemGray` 的实现与命名完全反了:
   - `CheckItem` 内部附加了 `dubbo.tag=gray`(实际在做灰度路由)
   - `CheckItemGray` 用 `context.Background()`(实际在做普通路由)
   
   **修复:** 交换两个方法的实现,使命名与行为一致。
   
   ### 修复 2:所有服务缺少 ConfigCenter 配置
   
   所有 8 个服务实例只配置了 `WithRegistry`,没有 `WithConfigCenter`。导致日志持续输出 "Config center 
does not start",Tag/Condition/Script Router 全部禁用。
   
   **修复:** 为所有服务添加 `WithConfigCenter(config_center.WithZookeeper(), 
config_center.WithAddress("127.0.0.1:2181"))`。
   
   涉及文件:
   - `frontend/server_v1/server.go`
   - `comment/server_v1/cmd/server.go`
   - `comment/server_v2/cmd/server.go`
   - `detail/server_v1/cmd/server.go`
   - `detail/server_v2/cmd/server.go`
   - `order/server_v1/cmd/server.go`
   - `order/server_v2/cmd/server.go`
   - `user/go-server/cmd/server.go`
   
   ### 修复 3:v2 服务缺少灰度标签
   
   v2 服务没有配置灰度标签,与 v1 在注册中心里无法区分,tag routing 无法命中灰度 provider。
   
   **修复:** 为 comment-v2、detail-v2、order-v2 添加实例级标签 `dubbo.WithTag("gray")` 
和服务级标签 `server.WithTag("gray")`。
   
   涉及文件:
   - `comment/server_v2/cmd/server.go`
   - `detail/server_v2/cmd/server.go`
   - `order/server_v2/cmd/server.go`
   
   ## 测试验证
   
   使用 Playwright 浏览器自动化验证:
   
   | 场景 | 预期 | 结果 |
   |---|---|---|
   | `/login` 普通登录 | 返回 v1 数据 | ✅ |
   | `/timeoutLogin` 超时登录 | 显示超时提示 | ✅ |
   | `/order` 下单 | 下单成功 | ✅ |
   | `/userinfo` 用户信息 | 返回用户信息 | ✅ |
   | `/grayLogin` 灰度登录 | 返回 v2 数据 | ❌ 需要框架修复 |
   
   ## 备注
   
   灰度登录(`/grayLogin`)需要 dubbo-go 框架层面的修复才能真正工作。`application.tag` 在 
service-discovery-registry 路径中未正确传播到 `dubbo.tag`,详见 
[apache/dubbo-go#3397](https://github.com/apache/dubbo-go/issues/3397) 和 
[apache/dubbo-go#3398](https://github.com/apache/dubbo-go/issues/3398)。
   
   本 PR 仅修复 sample 代码问题,不涉及框架改动。


-- 
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