Openclaw-go go-test
Run go test with race detector, analyze failures, fix issues, and re-run until green
install
source · Clone the upstream repo
git clone https://github.com/a3tai/openclaw-go
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/a3tai/openclaw-go "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.opencode/skills/go-test" ~/.claude/skills/a3tai-openclaw-go-go-test && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/a3tai/openclaw-go "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/.opencode/skills/go-test" ~/.openclaw/skills/a3tai-openclaw-go-go-test && rm -rf "$T"
manifest:
.opencode/skills/go-test/SKILL.mdsource content
What I do
Run the Go test suite with the race detector, analyze any failures, apply fixes, and iterate until all tests pass.
When to use me
Use this skill before committing changes, before opening a PR, or when asked to fix failing tests.
Workflow
-
Run the full test suite:
go test ./... -race -v -
Analyze failures — for each failing test:
- Identify the test function and file (e.g.,
)gateway/methods_test.go:TestChatSend - Read the test code and the code under test
- Determine root cause: type mismatch, missing mock, logic error, race condition, etc.
- Identify the test function and file (e.g.,
-
Fix the issue — apply the minimal correct fix:
- If the test expectation is wrong (API changed), update the test
- If the implementation is wrong, fix the implementation
- If a new type/method is missing, add it
- Never delete or skip tests to make the suite pass
-
Re-run tests:
go test ./... -race -
Repeat steps 2-4 until all tests pass.
-
Run vet as a final check:
go vet ./...
Test patterns in this repo
- Table-driven tests — most tests use
with[]struct{ name string; ... }t.Run() - Mock gateway —
uses a mock WebSocket server that validates request frames and sends response framesgateway/methods_test.go - Race detector — always use
; the gateway client is concurrent and race bugs are real-race - Coverage target — aim for 100% statement coverage on library packages
Key test files
| File | What it covers |
|---|---|
| All 96+ typed RPC methods |
| Connection lifecycle, handshake, reconnect |
| Serialization round-trips |
| Frame parsing edge cases |
| HTTP client, SSE streaming |
| Responses API, SSE events |
| Tools invoke HTTP client |
| mDNS discovery |
| JSON-RPC dispatch, handler interface |
Rules
- Never use
or-count=0
to hide failurest.Skip() - Always include
flag-race - Fix the root cause, not the symptom
- If a test is flaky, fix the flakiness rather than retrying