golang-testing

Write reliable Go test suites with table-driven subtests and goleak detection.

1|Updated May 26, 2026
One-click install
npx skills add https://github.com/tokiou/caba-inseguridad-v2-be --skill golang-testing-tokiou
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-testing
Source: https://github.com/tokiou/caba-inseguridad-v2-be/tree/main/.claude/skills/golang-testing
Command: npx skills add https://github.com/tokiou/caba-inseguridad-v2-be --skill golang-testing-tokiou

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go, gotests, and includes references (resource) components.

What problem does it solve?

This skill solves the problem of flaky, brittle, and incomplete Go tests by providing production-ready patterns that verify behavior, isolate dependencies, and detect concurrency issues early.

Core Features & Use Cases

  • Table-driven, idiomatic test design: Enforce named subtests, deterministic execution, and clear failure messages for fast iteration.
  • Reliable concurrency testing: Detect goroutine leaks with goleak and prefer deterministic time/goroutine control (e.g., synctest or injected clocks).
  • Practical verification coverage: Cover integration test separation via build tags, HTTP handlers with httptest, mocking interfaces (testify/suite patterns), and security-critical fuzzing.

Quick Start

Use the golang-testing skill to write a complete set of table-driven unit tests for your Go function, including edge cases, mocks, and race-safe patterns.

Frequently Asked Questions about golang-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write table-driven tests in Go that prevent flakiness?

Table-driven tests in Go prevent flakiness by enforcing named subtests for deterministic execution and clear failure messages. This approach isolates dependencies and constrains behavior to catch real bugs during fast iteration.

What is the best way to detect goroutine leaks in Go concurrency tests?

The best way to detect goroutine leaks in Go concurrency tests is using goleak. You should also prefer deterministic time and goroutine control, such as injected clocks or synctest, to ensure reliable concurrent behavior verification.

How do I separate integration tests from unit tests in Go using build tags?

You separate integration tests from unit tests in Go by applying build-tag separation. This isolates integration test execution, ensuring practical verification coverage without affecting the fast iteration cycle of standard unit tests.

Can I use httptest and testify mocking patterns for Go HTTP handler tests?

Yes, you can use httptest to verify HTTP handlers and testify suite patterns for mocking interfaces. These production-ready patterns isolate dependencies and provide practical verification coverage for real-world Go repositories.

Does Go fuzzing help find security-critical bugs in my test suite?

Go fuzzing provides practical verification coverage for security-critical bugs by automatically generating edge-case inputs. Incorporating fuzzing into your Go test suite helps catch unexpected behavior and vulnerabilities early in development.

Do I need gotests to generate idiomatic Go test scaffolding?

Yes, gotests is required as a dependency to generate idiomatic table-driven test scaffolding. It helps structure named subtests and edge cases, ensuring your Go test suite follows production-ready patterns immediately.