Misleading comments and small redundancies in the core path
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 半天
- 新手友好度
- 75/100
- Issue 類型
- 重構
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- go
- 領域
- cli, networking
研究方向
從引用的七行開始:internal/output/writer.go 和 internal/tui/model.go 中過時的 JSON 註解,internal/dns/resolver.go 中的 resolveWithLog 日誌呼叫,main_session.go 與 main.go 之間重複的 validateArgs 呼叫,以及 tuiOptions 中的兩條 fmt.Fprintf 警告。完成的標準是:註解描述的是串流輸出,對於 NODATA 結果 -v 不再印出 Error: <nil>,重複的驗證已移除,TUI 警告改為透過 diag 輸出。使用 -simulate 或本地測試伺服器,透過 make test 進行驗證,不要使用真實網域。
由索引模型根據 Issue 內容生成。
描述
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:28internal/tui/model.go:329internal/tui/model.go:346internal/dns/resolver.go:479main_session.go:288main.go:304main_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 onEmitat 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 caseResolvehandles at 500-505), so-vprintsFailed to resolve: x (Error: <nil>)for a definitive negative. - main_session.go:288 calls
validateArgs, andvalidateFlags(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:
tuiOptionswrites its two warnings straight to stderr withfmt.Fprintf, bypassing thediagwriter built ten lines earlier (main_session.go:162), so-tui -log-format jsonemits 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
-
-vno longer printsError: <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(orgo test ./...). Tests must stay hermetic: use-simulate,-simulate-zoneor 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 分鐘
- 30 天內合併 PR
- 7
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/subenum 的其他 Issue
-
area: docs documentation good first issue severity: low
難度 2/5 1-3 小時 新手友好度 85/100
TMHSDigital/subenum#327 ·
維護者通常 1 天內回覆
-
area: release dependencies good first issue severity: low
難度 2/5 1-3 小時 新手友好度 66/100
TMHSDigital/subenum#324 ·
維護者通常 1 天內回覆
-
ci good first issue severity: low
難度 2/5 1-3 小時 新手友好度 62/100
TMHSDigital/subenum#323 ·
維護者通常 1 天內回覆
-
area: output bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 76/100
TMHSDigital/subenum#319 ·
維護者通常 1 天內回覆
-
community documentation good first issue
難度 2/5 1-3 小時 新手友好度 85/100
TMHSDigital/subenum#135 ·
維護者通常 1 天內回覆
查看 TMHSDigital/subenum 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
GillMacedo/godebugdiff#13 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
GillMacedo/racesift#14 ·
-
IsTextFile reads the whole file into memory (OOM on large files in the file watcher)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
gtsteffaniak/filebrowser#3395 ·
維護者通常 1 天內回覆
-
effort:s impact:low raised-by:worker risk:low
難度 1/5 1 小時以內 新手友好度 70/100
medici-finance/assay#6496 · 1 則留言 ·
維護者通常 1 天內回覆
-
kind/bug require/reproduce require/severity
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆