go-testslisted
Install: claude install-skill contrastiskey/eetc-claude-code
# Go Test Conventions
Sources: [Go Test Comments](https://go.dev/wiki/TestComments), the test
sections of the Google Go Style Guide
([decisions](https://google.github.io/styleguide/go/decisions#useful-test-failures),
[best practices](https://google.github.io/styleguide/go/best-practices#tests)),
and the [`testing`](https://pkg.go.dev/testing) package.
General Go style (naming, errors, docs) lives in `eetc:go-code-style`.
Project-specific test commands, fixtures and fakes live in the repo's
CLAUDE.md or `codebase-overview` skill.
## Where tests live
| Kind | File | Package |
|------|------|---------|
| Unit | `foo_test.go` next to `foo.go` | `package foo`: can reach unexported names |
| Black box | `foo_test.go` next to `foo.go` | `package foo_test`: only the public API; also breaks import cycles |
| Example | `example_test.go` | `package foo_test`, so examples show the `foo.` qualifier users write |
| Fixtures | `testdata/` | ignored by the go tool |
- Test doubles that other packages' tests need go in a `footest` package
next to `foo` (`creditcardtest.Stub`), never in `foo` itself.
- Tests that need real infrastructure skip under `-short`
(`if testing.Short() { t.Skip("needs postgres") }`), or use the build tag
the repo already has.
## Running
| Command | What it runs |
|---------|-------------|
| `go test ./...` | Every package in the module |
| `go test ./internal/orders` | One package |
| `go test -run 'TestParse$' ./parser` | Tests matching the regexp |
| `g