[go-fan] Go Module Review: testify

Aperta Adatta ai principianti
#74,450 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
65/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
documentation

Direzione di ricerca

L'unica modifica proposta è un cambiamento dello stato in docs/adr/47252-testify-error-assertion-conventions.md, che attualmente riporta Status: Draft. Apri il file e verifica che la migrazione descritta corrisponda all'impostazione testifylint in .golangci.yml prima di cambiare la riga di stato in Accepted. Il lavoro è completo quando l'ADR riporta Accepted e nient'altro nel documento è cambiato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

automation cookie
Module Overview

github.com/stretchr/testify is Go's most widely used test-tooling library, providing assert/require for fluent assertions plus optional mock/suite packages. It's permanently frozen at v1 (no v2 planned — discussion #1560).

Current Usage in gh-aw
  • Files: require imported in 1362 _test.go files; assert in 1284 _test.go files — test-only, as expected (no production code imports it).
  • Call volume: ~26,575 assert.* calls, ~26,811 require.* calls.
  • Key APIs: Equal (12,825), NoError (15,111), ErrorContains/ErrorIs/EqualError (1,874 across 510 files), InDelta/JSONEq/YAMLEq (609 across 152 files), Eventually/EventuallyWithT/CollectT (13 across 7 files).
  • Not used: mock, suite — zero imports. Given t.Parallel() appears 4,714 times across 693 files, and testify's own README flags suite as unsupported for parallel tests (#934), skipping suite here is correct.
Research Findings

Current version in go.mod (v1.12.1) already matches the latest upstream release.

Recent Updates

v1.12.1 (2026-08-19) swapped testify's internal YAML dependency from the old gopkg.in/yaml.v3 fork to go.yaml.in/yaml/v3, shrinking testify's own dependency footprint to just go.yaml.in/yaml/v3 and the dependency-free stretchr/objx. No breaking changes — v1 is frozen; all improvements land as additive minor releases.

Best Practices

Maintainers recommend testifylint (via golangci-lint) to catch common misuse.

Improvement Opportunities

🏃 Quick Wins

.golangci.yml already enables testifylint with enable-all: true — the strictest setting, matching upstream's own recommendation. One loose end: docs/adr/47252-testify-error-assertion-conventions.md documents the ErrorContains/require.* migration (already merged and enforced by that lint rule, confirmed live with 1,874 ErrorContains/ErrorIs/EqualError call sites) but is still marked Status: Draft. Since the enforcement is live in CI and the described migration already landed, this ADR should be moved to Accepted.

✨ Feature Opportunities

None identified as required — the project already tracks testify's own recommended linter config at its strictest setting.

📐 Best Practice Alignment

Already strong across the board:

  • testifylint enable-all: true is live.
  • ErrorContains is used instead of the panic-prone assert.Contains(t, err.Error(), ...) pattern (eliminates nil-deref crashes on a nil err).
  • mock/suite are correctly avoided in favor of real fixtures and parallel subtests, which fits this codebase's heavy use of t.Parallel().
🔧 General Improvements

No further action identified beyond finalizing the ADR status above — testify usage here is mature and already follows upstream guidance closely.

Recommendations

  1. Move docs/adr/47252-testify-error-assertion-conventions.md from Status: Draft to Status: Accepted — the migration it describes is already merged and enforced by CI lint.

Next Steps

  • Finalize ADR-47252's status.
  • No dependency action needed; testify is already pinned to the latest release.

Generated by Go Fan
Module summary saved to: scratchpad/mods/testify.md

Generated by 🐹 Go Fan · claude · agent · ~80 AIC · ⌖ ~1 AIC · ⊞ 4.5K · ◷

  • expires on Nov 4, 2026, 12:07 AM UTC-08:00
Lingua principale
Go
Stelle
5.6k
Fork
615
Merge medio
4h 51m
PR unite (30g)
778

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di github/gh-aw

Tutte le issue di github/gh-aw

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.