Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

scan.Run should always end with exactly one EventDone

Aberta
#99 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
65/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go
Domínio
cli

Direção de pesquisa

Start in internal/scan/runner.go: read scan.Run, its early-exit paths, and the EventError documentation. Add coverage for each listed early exit and check that each produces exactly one EventDone; then review the CLI, TUI, and pkg/subenum consumers named in the issue. Done means all tests pass and no consumer handles a channel closing without EventDone.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area: scan enhancement

Why it matters

scan.Run has two shapes of ending, and every consumer has to know both. Three consumers now each handle it separately: the CLI (main.go), the TUI (internal/tui/model.go, scan_view.go), and pkg/subenum, which adds an extra KindDone so its callers see one shape.

Evidence

  • On five early-exit paths, scan.Run sends EventError and returns without EventDone: an out-of-scope domain, the recursion ceiling, a failed preflight, a failed wildcard check, and a wildcard zone without -force (internal/scan/runner.go, about lines 434–495). Only the deferred close(events) runs.
  • EventError is documented as "non-fatal error message" (runner.go:345). In practice, five of its six uses stop the scan. The sixth, the reliability guard at line 877, is followed by EventDone.
  • The CLI comment says "Early errors such as wildcard detection close the channel without EventDone". The TUI has a closed flag for "the scan ended without EventDone".

Suggested approach

  • Have scan.Run always send exactly one EventDone, with Stats (all zero when nothing was scanned), even after an early EventError.
  • Fix the EventError doc comment to say it usually means the scan stopped.
  • Then remove the special cases: the CLI drain comment, the TUI closed path, and the synthesized event in pkg/subenum's Run.

Done when

scan.Run always ends with one EventDone, a test covers each early-exit path, and none of the three consumers has to handle a channel that closes without one.

Linguagem predominante
Go
Estrelas
1
Forks
1
Merge médio
14d 9h
PRs com merge (30d)
1

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TMHSDigital/subenum

Todas as issues de TMHSDigital/subenum

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.