Commit Graph

1 Commits

Author SHA1 Message Date
luwanzhou 2f4b7674d6 fix(output): deterministic --format table ordering and show error status code
--format table 的渲染依赖 Go map 随机遍历顺序:printMapTable 的行顺序、
以及 collectKeys 补全非优先列后 printSliceTable 的列顺序,每次运行都可能不同,
导致同一命令两次输出不一致,难以对比/diff/脚本断言。

- collectKeys:优先列之后的剩余列改为 sort.Strings 排序,顺序稳定可预期。
- printMapTable:按 collectKeys 顺序输出,行序确定且与列表表列序一致。
- 错误输出:有错误码时显示 Error [<code>]: <message>,便于区分 404/422/500。

仅稳定 table 呈现顺序并丰富错误提示,不影响 json/yaml 输出与成功数据内容。
新增单测覆盖排序、25 次渲染确定性、错误码展示。
2026-06-15 12:59:23 +08:00