Misleading comments and small redundancies in the core path

Abierto Apto para principiantes
#329 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
Medio día
Aptitud para principiantes
75/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
cli, networking

Línea de trabajo

Empieza por las siete líneas citadas: los comentarios JSON obsoletos en internal/output/writer.go y internal/tui/model.go, la llamada de registro resolveWithLog en internal/dns/resolver.go, la llamada duplicada a validateArgs entre main_session.go y main.go, y las dos advertencias fmt.Fprintf en tuiOptions. Se considera terminado cuando los comentarios describen la salida en streaming, -v ya no muestra Error: <nil> para un resultado NODATA, se elimina la validación duplicada y las advertencias de la TUI pasan por diag. Verifica con make test usando -simulate o el servidor de pruebas local, no un dominio en vivo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

good first issue severity: low tech-debt

Summary

A checklist of small items: three comments that still say JSON output is buffered, a verbose log line that labels a definitive negative as a failure with Error: <nil>, a validation call that runs twice, and two TUI warnings that bypass the diagnostics writer.

Where

  • internal/output/writer.go:28
  • internal/tui/model.go:329
  • internal/tui/model.go:346
  • internal/dns/resolver.go:479
  • main_session.go:288
  • main.go:304
  • main_session.go:230

Details

Checklist, each item read at the cited line:

  • writer.go:28: "FormatJSON buffers results and emits a single JSON array at completion". Since #181 it streams each element (writeJSONElement, writer.go:255-284); the comment on Emit at 175-178 says so correctly.
  • tui/model.go:329-330 and 346-347: "finalize structured output so buffered JSON/CSV is written" and "buffered JSON array emitted": same stale description of JSON.
  • resolver.go:478-479: l.Logf("Failed to resolve: %s (Error: %v) in %s", domain, err, elapsed) also runs when the lookup succeeded with no records of the requested types (err == nil, the NODATA case Resolve handles at 500-505), so -v prints Failed to resolve: x (Error: <nil>) for a definitive negative.
  • main_session.go:288 calls validateArgs, and validateFlags (called at 318) calls it again as its first statement (main.go:304). The second call can never fail.
  • main_session.go:230 and 240: tuiOptions writes its two warnings straight to stderr with fmt.Fprintf, bypassing the diag writer built ten lines earlier (main_session.go:162), so -tui -log-format json emits plain text lines among JSON ones.

Impact

Readers are told JSON output is held in memory when it is not (relevant to anyone reasoning about memory or partial output), verbose logs label negatives as failures, and two small inconsistencies add noise. None changes results.

Suggested fix

Reword the three comments to "streamed as array elements; Finish closes the array". In resolveWithLog, branch on err == nil and log "No records: %s (%s) in %s". Drop the validateArgs call from validateFlags or from configure. Route the two TUI warnings through diag.Notice.

Acceptance criteria

  • Each checklist item under Details is fixed
  • -v no longer prints Error: <nil>

Getting started

  • Relevant files: internal/output/writer.go, internal/tui/model.go, internal/dns/resolver.go, main_session.go
  • How to run tests: make test (or go test ./...). Tests must stay hermetic: use -simulate, -simulate-zone or the local DNS test server, never a live domain.
  • Related docs: docs/DEVELOPER_GUIDE.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at d0c56f0. Severity: low. Effort: S. audit-key: tech-debt|internal/output/writer.go|comments

Lenguaje dominante
Go
Estrellas
1
Forks
1
Merge medio
6 h 42 min
PR fusionados (30 d)
7

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TMHSDigital/subenum

Todos los issues de TMHSDigital/subenum

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.