[go-fan] Go Module Review: github.com/charmbracelet/x/exp/golden
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 68/100
Línea de trabajo
El cambio está en pkg/console/golden_test.go en las líneas 340, 345, 350 y 355, donde []byte(bar.Update(...)) se pasa a golden.RequireEqual. Compara estas con las llamadas cercanas que ya pasan la cadena directamente, luego elimina los cuatro casts. Ejecuta go test ./pkg/console/... para confirmar que los fixtures golden siguen coincidiendo. Está terminado cuando los casts se hayan eliminado y las pruebas pasen sin regenerar ningún fixture.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🐹 Go Fan Report: github.com/charmbracelet/x/exp/golden
Module Overview
golden is a tiny (~90 LOC) golden-file testing helper from the charmbracelet/x monorepo. It exposes one generic function, RequireEqual[T []byte | string](tb, out), that diffs test output against a testdata/<TestName>.golden fixture (escaping control/ANSI sequences before comparing), and can regenerate fixtures when run with -update.
Current Usage in gh-aw
- Files: 2 (
pkg/console/golden_test.go,pkg/workflow/wasm_golden_test.go) - Import Count: 2
- Call sites: 14 total (11 + 3)
- Key APIs Used:
golden.RequireEqualonly (current, non-deprecated API) - Golden regeneration is already wired into
make update-goldenandmake update-wasm-golden, both passing-update- exactly the workflow the module documents.
Research Findings
exp/golden/v0.1.0 (pinned in go.mod) is the only tag ever cut for this submodule and remains the latest release, even though the parent charmbracelet/x monorepo is very active (most recent push 2026-10-12, on an unrelated submodule). Nothing to upgrade to.
Recent Updates
All already baked into the pinned v0.1.0 tag:
- feat(exp/golden): accept strings on RequireEqual (2025-06-02) - added generics so callers no longer need to wrap string output in []byte(...).
- RequireEqualEscape was deprecated in favor of RequireEqual (escaping is now always on by default).
- No security advisories or breaking changes found.
Best Practices
Maintainers recommend calling RequireEqual directly with either string or []byte output (no manual conversion needed since generics landed), and exposing a -update test flag/make target for fixture regeneration.
Improvement Opportunities
🏃 Quick Wins
pkg/console/golden_test.go:340,345,350,355 still wrap ProgressBar.Update(...) (which returns string) in an unnecessary []byte(...) conversion before calling golden.RequireEqual. Every other call site in the same file (RenderTable, FormatError, RenderInfoSection, etc.) already passes the string directly. Dropping these 4 remaining casts removes a small unneeded allocation per call and makes the file internally consistent:
Affected lines
// pkg/console/golden_test.go
340: golden.RequireEqual(t, []byte(bar.Update(0)))
345: golden.RequireEqual(t, []byte(bar.Update(512*1024*1024)))
350: golden.RequireEqual(t, []byte(bar.Update(1024)))
355: golden.RequireEqual(t, []byte(bar.Update(0)))
Change each to golden.RequireEqual(t, bar.Update(...)).
✨ Feature Opportunities
None currently applicable - the only tagged release (v0.1.0) already contains every feature gh-aw relies on (string support, escaping, Windows CRLF normalization), and there is no newer upstream tag to adopt.
📏 Best Practice Alignment
- Golden regeneration already follows the documented -update flag pattern via dedicated make targets.
- No usage of the deprecated RequireEqualEscape was found anywhere in the codebase.
🔧 General Improvements
pkg/workflow/wasm_golden_test.go runs its own normalizeOutput helper (stripping env-specific flags, trimming trailing newlines) before calling RequireEqual. This is project-specific normalization and does not overlap with what the library provides (control-sequence escaping, CRLF normalization) - no redundancy to clean up.
Recommendations
- Apply the quick win above (drop the 4 redundant []byte(...) casts in pkg/console/golden_test.go) - small, safe, mechanical cleanup.
- No version bump or feature adoption needed; the module is already on its latest (and only) release and is used idiomatically elsewhere in the codebase.
Next Steps
No further action needed beyond the quick win above; re-review this module once charmbracelet/x/exp/golden cuts a new tag (none exists yet beyond v0.1.0).
Generated by Go Fan
Module summary saved to: scratchpad/mods/charmbracelet-x-exp-golden.md
Generated by 🐹 Go Fan · claude · agent · 126.8 AIC · ⊞ 6.5K · ◷
- expires on Oct 16, 2026, 12:05 AM UTC-08:00
- Lenguaje dominante
- Go
- Estrellas
- 5.4k
- Forks
- 584
- Merge medio
- 3 h 26 min
- PR fusionados (30 d)
- 822
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/gh-aw
-
automation models
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
ai-inspected
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
automation cli cookie documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
github/gh-aw#70526 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
agentic-workflows
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
automated conformance good-first-issue safe-outputs
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
Todos los issues de github/gh-aw
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
aws/amazon-ecs-agent#5177 ·
Los mantenedores suelen responder en 2 días
-
release-followup
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/rocketmq-dashboard#7292 ·
Los mantenedores suelen responder en 3 días
-
[Bug]: Deleting an MCP proxy leaves its API keys in the gateway's memory and in the policy engineAbiertoAspect/API Aspect/Other Severity/Minor Type/Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
wso2/api-platform#3852 ·
Los mantenedores suelen responder en 1 día