Go testing
AI plugin for coding standards for Go
npx -y skills add Cadasto/go-coding-plugin --skill go-testingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Idiomatic Go testing. This skill should be used when the user writes or reviews Go tests, benchmarks, or fuzz targets — table-driven tests, `t.Parallel`, `testing.B.Loop`, the race detector, goroutine-leak detection, `testing/synctest` for time/concurrency, fuzzing, or golden files. Pair with `go test -race`. Not for non-Go test frameworks; error-wrapping belongs to `go-errors`.
SKILL.md
3.1 KB, as published. Nobody here has run it
go-testing — Go testing
Deterministic backstop: go test -race ./... (always, in CI), go test -bench, go test -fuzz.
Rules
- Table-driven tests: a named-case slice +
t.Run(tc.name, func(t *testing.T){ … }). Since Go 1.22 thetc := tccopy is unnecessary — drop it (modernize/copyloopvarflag it). t.Parallel()on independent tests to cut wall-clock; watch for shared mutable state and loop-var capture in the parallel body.- Benchmarks:
for b.Loop() { … }(Go 1.24) — it handles timer reset and run scaling; replacesfor i := 0; i < b.N; i++plus manualb.ResetTimer(). -raceis non-negotiable for any code touching goroutines; wire it into CI.- Goroutine-leak detection:
go.uber.org/goleak—goleak.VerifyTestMain(m)or per-testdefer goleak.VerifyNone(t). testing/synctest(stable since Go 1.25) is the default for time/concurrency tests — timeouts, tickers, retries,contextcancellation. It runs the bubble on a fake clock with deterministic scheduling, so "5-second" waits complete in microseconds and flakiness disappears. Wrap withsynctest.Test(t, func(t *testing.T){ … });synctest.Wait()blocks until every goroutine in the bubble is durably blocked. Reach for it instead oftime.Sleep-based polling. (The pre-1.25GOEXPERIMENT=synctestAPI —synctest.Run— was removed in Go 1.26; use the stablesynctest.Test.)- Fuzzing (
func FuzzX(f *testing.F)) for parsers, codecs, and anything consuming untrusted bytes. Golden files (an-updateflag writingtestdata/*.golden) for large structured output. - Deterministic crypto tests (Go 1.26):
testing/cryptotest.SetGlobalRandom(t, seed)pins a deterministic randomness source for the test's duration — reach for it instead of hand-injecting a customio.Readerwhen testing code that draws fromcrypto/rand. It's process-global, so it can't run inside at.Parallel()test (or one with a parallel ancestor). - Assertions: stdlib + small helpers (
t.Helper()) is often enough;testifyis fine — match the repo, don't mix styles.
Sources
- synctest — https://go.dev/blog/synctest;
testing.B.Loop— https://go.dev/blog/testing-b-loop testingpackage — https://pkg.go.dev/testing; Go 1.22/1.24/1.25/1.26 release notes — https://go.dev/doc/go1.26testing/cryptotest(Go 1.26) — https://pkg.go.dev/testing/cryptotestgo.uber.org/goleak— https://pkg.go.dev/go.uber.org/goleak
Decomposition inspired by samber/cc-skills-golang (MIT © 2026 Samuel Berthe); rules grounded in the sources above.