Misleading comments and small redundancies in the core path

オープン 初心者向け
#329 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
半日
初心者へのやさしさ
75/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
cli, networking

調査の方向性

引用されている7行から始めてください。internal/output/writer.go と internal/tui/model.go の古いJSONコメント、internal/dns/resolver.go の resolveWithLog のログ呼び出し、main_session.go と main.go にまたがる validateArgs の重複呼び出し、そして tuiOptions 内の2つの fmt.Fprintf 警告です。コメントがストリーミング出力を説明しており、NODATA結果に対して -v が Error: <nil> を表示せず、重複した検証が削除され、TUIの警告が diag を経由するようになれば完了です。実際のドメインではなく、-simulate またはローカルのテストサーバーを使って make test で検証してください。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Go
スター
1
フォーク
1
平均マージ
6時間 42分
マージ済み PR(30日)
7

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/subenum のほかの issue

TMHSDigital/subenum の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。