go-testing

Standardize Go test patterns with table-driven tests and semantic checks.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/phant-app/phant --skill go-testing-phant-app
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/phant-app/phant/tree/main/.agents/skills/go-testing
Command: npx skills add https://github.com/phant-app/phant --skill go-testing-phant-app

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go testing can be verbose and error-prone; this guide consolidates patterns from Google and Uber to help you write clear, maintainable Go tests that diagnose failures without digging into test sources.

Core Features & Use Cases

  • Table-driven tests and subtests for comprehensive coverage and organized test structure.
  • Parallel tests and proper setup/teardown with t.Helper and t.Cleanup to speed up feedback loops.
  • No assertion libraries: prefer standard assertions and diffs (e.g., cmp.Diff) for reliable failure messages.
  • Error semantics: use errors.Is and semantic checks to ensure robust failure handling.
  • Test helpers: guidelines for creating helpers with t.Helper() and clean, reusable patterns.

Quick Start

Start by adopting table-driven tests with t.Run subtests and semantic comparisons using cmp.Diff for clear, diagnosable failures.

Frequently Asked Questions about go-testing

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

FAQPage Schema
What is the best way to structure table-driven tests in Go?

Table-driven tests in Go combine test cases into a slice and iterate using t.Run subtests. This structure provides comprehensive coverage, organized output, and clear diagnosable failures without duplicating test logic.

How do I get clear failure messages in Go tests without an assertion library?

To get clear failure messages without an assertion library, use standard Go testing and cmp.Diff for structured comparisons. This approach produces reliable diffs that diagnose failures without digging into test source code.

How do I speed up Go test execution with parallel tests?

Speed up Go test execution by running parallel tests with t.Parallel. Proper setup and teardown using t.Helper and t.Cleanup ensure isolated state while accelerating feedback loops across table-driven subtests.

How should I handle errors in Go test helpers?

Handle errors in Go test helpers by marking them with t.Helper() and using semantic checks like errors.Is. This ensures robust failure handling and keeps helper stack traces clean and reusable.

Do these Go testing patterns work for projects of any size?

These Go testing patterns work for projects of various sizes. They consolidate standardized guidelines from Google and Uber style guides to maintain clear, maintainable test structures across small and large codebases alike.