/go-test Command
This command enforces test-driven development methodology for Go code using idiomatic Go testing patterns.What This Command Does
- Define Types/Interfaces: Scaffold function signatures first
- Write Table-Driven Tests: Create comprehensive test cases (RED)
- Run Tests: Verify tests fail for the right reason
- Implement Code: Write minimal code to pass (GREEN)
- Refactor: Improve while keeping tests green
- Check Coverage: Ensure 80%+ coverage
When to Use
Use/go-test when:
- Implementing new Go functions
- Adding test coverage to existing code
- Fixing bugs (write failing test first)
- Building critical business logic
- Learning TDD workflow in Go
TDD Cycle
Command Syntax
Description of the Go functionality to implement with TDD
Test Patterns
Table-Driven Tests
Parallel Tests
Coverage Commands
Coverage Targets
| Code Type | Target |
|---|---|
| Critical business logic | 100% |
| Public APIs | 90%+ |
| General code | 80%+ |
| Generated code | Exclude |
Related
- Skill:
skills/golang-testing/,skills/tdd-workflow/ - Commands:
/go-build,/go-review,/verify