| id | 2606211908 |
|---|---|
| title | arch-fix: split internal/lint/layer0.go |
| status | ✅ |
| summary | Split layer0.go (1 203 lines) into focused sibling files along block-type sub-parsers to stay within the 1 000-line guideline. |
| model | |
| depends-on |
Audit 2026-06-21 flagged
internal/lint/layer0.go
at 1 203 lines.
The file holds the entire Layer-0 block scanner. It packs seven sub-parsers together:
- Exported types (
BlockKind,BlockSpan,Layer0Scan) - Scanner state machine
- HTML-block detection (types 1–7)
- Fence handling
- ATX-heading detection
- Indented-code detection
- Paragraph scanning
One file for all of these makes targeted changes risky. Locating the relevant section is slow.
Split layer0.go into sibling files within
internal/lint. Each sibling covers one or
two block-type sub-parsers. The primary file
stays under 600 lines.
- Create
internal/lint/layer0_html.go: move HTML-block detection (types 1–7),openHTMLBlock,htmlBlockCloses,tagName, and related helpers. - Create
internal/lint/layer0_fence.go: move fence-state logic (fenceInfo,openingFence,closingFence,advanceFenceState,tryFence). - Create
internal/lint/layer0_para.go: move paragraph scanning (scanParagraph,markSetextRun,paragraphLeadKind,SourceMayHaveCodeBlock). - Remove the moved blocks from
layer0.goand trim now-unused file-local symbols. - Run
go build ./...— confirm no errors. - Run
go test ./...— confirm no regressions. - Confirm
wc -l layer0.gois under 600 lines.
-
internal/lint/layer0.gois under 600 lines. -
go build ./...passes. -
go test ./...passes. -
go tool golangci-lint runreports no new issues. - No logic changed — pure file
reorganisation within the
lintpackage.