Skip to content

Commit 6f86ee5

Browse files
committed
fix: resolve golangci-lint failures in internal/tui
- scan_view.go: convert if-else chain to switch statement (gocritic) - scan_view.go: fix struct field alignment for gofmt - form.go: align inputForField array values for gofmt - form.go: remove empty if branch in space key handler (gocritic) Made-with: Cursor
1 parent 1d2561d commit 6f86ee5

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

internal/tui/form.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ var (
4141
// Fields 2 (Simulate) and 8 (Force) are toggles, not text inputs.
4242
// Field 3 (HitRate) is a text input but only rendered when simulate=ON.
4343
var inputForField = [fieldCount]int{
44-
0, // fieldDomain → inputs[0]
45-
1, // fieldWordlist → inputs[1]
46-
-1, // fieldSimulate → toggle
47-
2, // fieldHitRate → inputs[2]
48-
3, // fieldDNSServer → inputs[3]
49-
4, // fieldConcurrency → inputs[4]
50-
5, // fieldTimeout → inputs[5]
51-
6, // fieldAttempts → inputs[6]
52-
-1, // fieldForce → toggle
44+
0, // fieldDomain → inputs[0]
45+
1, // fieldWordlist → inputs[1]
46+
-1, // fieldSimulate → toggle
47+
2, // fieldHitRate → inputs[2]
48+
3, // fieldDNSServer → inputs[3]
49+
4, // fieldConcurrency → inputs[4]
50+
5, // fieldTimeout → inputs[5]
51+
6, // fieldAttempts → inputs[6]
52+
-1, // fieldForce → toggle
5353
}
5454

5555
// formModel is the configuration form screen.
@@ -179,10 +179,6 @@ func (m formModel) Update(msg tea.Msg) (formModel, tea.Cmd) {
179179
case " ":
180180
if m.isToggle() {
181181
m.toggles[m.toggleArrayIndex()] = !m.toggles[m.toggleArrayIndex()]
182-
// If we just turned simulate OFF and focus is on HitRate, skip past it.
183-
if m.focus == fieldSimulate && !m.toggles[0] {
184-
// HitRate is now hidden; nudge focus forward if it would land there.
185-
}
186182
}
187183
}
188184
}

internal/tui/scan_view.go

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ var (
2020

2121
// scanViewModel is the live-results screen.
2222
type scanViewModel struct {
23-
viewport viewport.Model
24-
progress progress.Model
25-
results []string
26-
messages []string // wildcard / error messages
27-
processed int64
28-
total int64
29-
found int64
30-
done bool
31-
aborted bool
32-
width int
33-
height int
34-
simMode bool
23+
viewport viewport.Model
24+
progress progress.Model
25+
results []string
26+
messages []string // wildcard / error messages
27+
processed int64
28+
total int64
29+
found int64
30+
done bool
31+
aborted bool
32+
width int
33+
height int
34+
simMode bool
3535
}
3636

3737
func newScanViewModel(width, height int, simMode bool) scanViewModel {
@@ -123,18 +123,19 @@ func (m scanViewModel) View() string {
123123
b.WriteString(m.progress.ViewAs(pct) + "\n")
124124

125125
// Status line
126-
if m.done && m.aborted {
126+
switch {
127+
case m.done && m.aborted:
127128
b.WriteString(dimStyle.Render(fmt.Sprintf(
128129
"Aborted — processed %d/%d — found %d",
129130
m.processed, m.total, m.found,
130131
)) + "\n")
131-
} else if m.done {
132+
case m.done:
132133
b.WriteString(summaryStyle.Render(fmt.Sprintf(
133134
"Done — processed %d/%d — found %d subdomain(s)",
134135
m.processed, m.total, m.found,
135136
)) + "\n")
136137
b.WriteString(hintStyle.Render(" r new scan • q quit"))
137-
} else {
138+
default:
138139
b.WriteString(dimStyle.Render(fmt.Sprintf(
139140
" %d/%d processed • %d found",
140141
m.processed, m.total, m.found,

0 commit comments

Comments
 (0)