go-testing

Automate Go unit test creation, verification, and review with table-driven tests.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/canopy-network/launchpad --skill go-testing-canopy-network
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-testing
Source: https://github.com/canopy-network/launchpad/tree/main/.claude/skills/go-testing
Command: npx skills add https://github.com/canopy-network/launchpad --skill go-testing-canopy-network

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes Go unit testing, encouraging deterministic, well-structured tests and preventing flaky results.

Core Features & Use Cases

  • Table-Driven Tests: Use table-driven patterns for coverage.
  • Test Structure Template: Provide a reusable TestFunctionName pattern with setup, execution, and verification.
  • Use Case: Add tests for edge cases, invalid inputs, and boundary values using t.Run subtests.

Quick Start

Create a test like: func TestXxx(t testing.T) { / test body here */ }

Frequently Asked Questions about go-testing

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

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

Table-driven tests in Go use a slice of test cases with input and expected output, iterated with t.Run() subtests for each case. This pattern reduces code duplication and improves coverage of edge cases and boundary values in a single test function.

What's the best way to structure Go unit tests?

Go unit tests follow a setup-execute-verify pattern with descriptive test-case names and t.Run() subtests. This structure improves readability, isolates failures, and standardizes test organization across projects.

How do I add tests for edge cases and invalid inputs in Go?

Define test cases in a table covering edge cases, boundary values, and invalid inputs, then iterate with t.Run() subtests to verify each scenario. This ensures comprehensive coverage and catches unexpected behavior systematically.

Can I use testify/assert with Go table-driven tests?

Yes, testify/assert integrates with table-driven tests to simplify assertions within each subtest. It provides readable failure messages and works seamlessly with t.Run() subtests for cleaner verification logic.

Why do Go tests become flaky and how do I prevent it?

Flaky tests result from non-deterministic behavior, timing issues, or incomplete setup. Table-driven tests with proper setup, isolated subtests via t.Run(), and deterministic test data prevent flakiness and ensure consistent results.

Do I need Make targets to run Go unit tests?

Make targets are optional but recommended for standardizing test execution across projects. They integrate with Go testing workflows to scaffold tests, run test suites, and enforce project conventions consistently.