mochengqian opened a new issue, #1078:
URL: https://github.com/apache/dubbo-go-samples/issues/1078

   ## 问题描述
   将 `dubbo-go-samples` 依赖升级到 `dubbo.apache.org/dubbo-go/[email protected]` 
后,对 `registry`、`router` 目标目录做 README copy-paste 验收,发现多个 README 命令块不能由普通用户直接执行。
   
   问题包括:
   
   - README 命令路径错误;
   - 部分命令依赖固定工作目录;
   - router client 发生 RPC 错误但脚本退出码仍可能成功;
   - 注册中心样例日志 warning 容易误导;
   - 固定端口 / 默认 namespace / 历史 registry 数据会污染复测;
   - 依赖升级后如果 `go.sum` 未同步,fresh clone 会先因为 checksum 缺失失败,无法进入真实 sample 行为验证。
   
   这类问题会降低 samples 作为版本验收材料的可信度。
   
   ## 环境与配置
   
   - 代码库:`apache/dubbo-go-samples`
   - dubbo-go 依赖:`dubbo.apache.org/dubbo-go/[email protected]`
   - Go 版本:`go1.26.1 darwin/arm64`
   - 项目 `go.mod`:`go 1.25.0`
   - 操作系统:macOS 26.4.1 darwin/arm64
   - 主要验收目录:
     - `registry`
     - `router`
   - 验证方式:
     - fresh clone / clean copy
     - 逐条执行 README command block
     - 对注册中心样例使用唯一 namespace/group 并清理历史数据
   
   ## 复现步骤
   
   1. fresh clone `dubbo-go-samples`。
   2. 将 dubbo-go 依赖升级到 `dubbo.apache.org/dubbo-go/[email protected]`。
   3. 按 `registry`、`router` 目录 README 中的命令块逐条执行。
   4. 记录每个命令块的退出码、日志和实际行为。
   5. 对需要注册中心的样例,使用唯一 namespace/group,测试前后清理 configs / instances / mappings / 
route rules。
   
   ## 实际结果
   
   本轮验收发现多类可复现问题。
   
   `router/tag/README_CN.md` 中存在命令路径疑似错误:
   
   ```text
   go run ./go-tag-server/cmdserver_tag.go
   ```
   
   该命令疑似缺少 `/`,应为类似下面的路径:
   
   ```text
   go run ./go-tag-server/cmd/server_tag.go
   ```
   
   `router/polaris` README 没有给出完整 route rule 初始化流程,也没有说明 discovery 
fallback。用户直接运行时,Dev / Pre / Prod 命中结果可能混合或不稳定。
   
   `registry/zookeeper` README 依赖 `./zkCli.sh` 等命令,但用户从 README 
所在目录直接执行时路径不成立;zookeeper 相关 curl / 初始化步骤也不够自包含。
   
   `registry/polaris` 基础 RPC 可以成功,但日志出现 warning:
   
   ```text
   no metadata report factory of protocol polaris found
   registry directory polaris does not exist
   ```
   
   对普通用户来说,这很容易被理解成配置错误或功能缺失。
   
   依赖升级后如果 `go.sum` 未同步,clean clone 下部分 `go run` 会先因为缺少 checksum 失败,无法进入 sample 
行为验证。
   
   此外,多个样例使用固定端口和默认 namespace/group,历史 instances / configs / mappings / route 
rules 可能污染下一轮测试。
   
   ## 预期结果
   
   1. 用户 fresh clone 后,按 `registry`、`router` README 命令逐条执行,应能复现 README 描述的结果。
   2. 升级 dubbo-go 依赖时,`go.mod` 和 `go.sum` 应一起更新,避免 clean clone 首次运行失败。
   3. router client 如果 RPC 调用失败,应返回非 0 退出码,避免脚本误报成功。
   4. 依赖注册中心的样例应提供 namespace/group 隔离和清理建议。
   5. README 应明确哪些步骤需要手工配置控制台规则,哪些可以用脚本初始化。
   6. warning 如果是预期行为,应在 README 中说明;如果不是预期,应补齐配置或修复 sample。
   
   ## 可能的原因
   
   - README 命令路径与当前目录结构漂移;
   - 缺少 route rule / registry 初始化脚本;
   - 缺少 clean clone / go.sum 验证;
   - client 错误没有严格转成退出码;
   - 注册中心样例没有统一隔离和清理;
   - warning 未分类为可忽略或需修复。
   
   ## 可能的修复方法
   
   1. 为 `registry`、`router` 增加 README command block smoke test:
      - fresh clone;
      - `go mod tidy` 或校验 `go.sum`;
      - 按 README 命令逐条执行;
      - 验证退出码和关键日志。
   2. 修正已知 README 路径问题,例如 `router/tag/README_CN.md` 的 `cmdserver_tag.go`。
   3. 为 Polaris / Nacos / Zookeeper 等注册中心样例补充初始化脚本和清理脚本。
   4. 对 router client 增加错误退出码,避免 `No provider available` 时脚本仍然通过。
   5. 文档中明确 warning 的语义:
      - 是可忽略噪声;
      - 是可选 metadata report 未配置;
      - 还是 sample 配置缺失。
   6. 长期建议增加一套 samples smoke test,覆盖固定目标目录,并使用唯一 namespace/group 与随机端口降低污染。
   


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