SuperAPI AI 工具集

test-go-binding

测试与质量

查看项目

更新于 10-16 02:34

技能介绍

用途:当改动主要位于 go/nemo_relay 或依赖的 Go 绑定行为时,使用本技能构建并测试 NeMo Relay 的 Go 绑定。建议配合 karpathy-guidelines 进行实现或评审,保持改动范围收敛、明确假设,并在编辑前定义聚焦的验证方式。

主要能力与约束:Go 绑定链接共享 FFI 库。just test-go 会为你构建该库;just build-go 适合仅构建或需要该产物用于其他工作。

默认流程:用 cd go/nemo_relay && go fmt ./... 格式化改动的 Go 包;用 just test-go 运行 Go 测试。若 Go 工作同时改动了 Rust 文件,还需运行 cargo fmt --all、just test-rust 和 cargo clippy --workspace --all-targets -- -D warnings。需要仅构建时用 just build-go;需要 CI 风格覆盖率与 JUnit 产物时用 just ci=true test-go。仅当改动触及共享语义时才扩大验证范围。

常用命令:

完整 Go 套件

just test-go

格式化 Go 文件

cd go/nemo_relay && go fmt ./...

Go 改动同时触及 Rust 代码时必需

cargo fmt --all just test-rust cargo clippy --workspace --all-targets -- -D warnings

CI 风格 Go 套件,含覆盖率与 JUnit 产物

just ci=true test-go

需要单独显式构建共享库时

just build-go

在 test-go 任务中,ci 变量由 is_true "{{ ci }}" 检查;设置 ci=true 会启用 coverage_out 与 junit_out 处理,并向 go_test_cmd 添加 -coverprofile=coverage.out。在 macOS 上直接运行原始 go test 命令前,还需将 DYLD_LIBRARY_PATH 设为相同的 ../../target/release 目录。

升级条件:若改动触及 crates/ffi,还需使用 test-ffi-surface;若触及 crates/core 或共享运行时语义,还需使用 validate-change。

参考:go/nemo_relay/go.mod、go/nemo_relay/nemo_relay.go、README.md、docs/getting-started/installation.md、validate-change。