Skip to content

Commit 9b914c7

Browse files
committed
fix(hawk): restore chat_commands.go and fix remaining close errcheck
- Restored cmd/chat_commands.go after accidental empty by sed - Fixed f.Close/f.WriteString errcheck in chat_commands, dx, errors - Fixed store.Close in cmdhistory_cmd.go - Fixed rows.Close in cmdhistory/history.go - Fixed b.store.Close in memory/yaad_bridge.go
1 parent 227232b commit 9b914c7

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

cmd/chat_commands.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,8 @@ func (m *chatModel) handleCommand(text string) (tea.Model, tea.Cmd) {
15611561
if err != nil {
15621562
m.messages = append(m.messages, displayMsg{role: "error", content: err.Error()})
15631563
} else {
1564-
f.WriteString(parts[1] + "\n")
1565-
f.Close()
1564+
_, _ = f.WriteString(parts[1] + "\n")
1565+
_ = f.Close()
15661566
m.messages = append(m.messages, displayMsg{role: "system", content: fmt.Sprintf("Tagged: %s", parts[1])})
15671567
}
15681568
return m, nil
@@ -1626,10 +1626,10 @@ func (m *chatModel) handleCommand(text string) (tea.Model, tea.Cmd) {
16261626
return m, nil
16271627
case "/sandbox":
16281628
if string(m.session.Mode) == "acceptEdits" {
1629-
_ = m.session.SetPermissionMode("default")
1629+
m.session.SetPermissionMode("default")
16301630
m.messages = append(m.messages, displayMsg{role: "system", content: "Sandbox ON — all actions require approval."})
16311631
} else {
1632-
_ = m.session.SetPermissionMode("acceptEdits")
1632+
m.session.SetPermissionMode("acceptEdits")
16331633
m.messages = append(m.messages, displayMsg{role: "system", content: "Sandbox OFF — file edits auto-approved, other actions require approval."})
16341634
}
16351635
return m, nil
@@ -1958,10 +1958,10 @@ func (m *chatModel) handleCommand(text string) (tea.Model, tea.Cmd) {
19581958

19591959
case "/yolo":
19601960
if string(m.session.Mode) == "bypassPermissions" {
1961-
_ = m.session.SetPermissionMode("default")
1961+
m.session.SetPermissionMode("default")
19621962
m.messages = append(m.messages, displayMsg{role: "system", content: "Yolo mode OFF — all actions require approval."})
19631963
} else {
1964-
_ = m.session.SetPermissionMode("bypassPermissions")
1964+
m.session.SetPermissionMode("bypassPermissions")
19651965
m.messages = append(m.messages, displayMsg{role: "system", content: "⚠ Yolo mode ON — all tool calls auto-approved."})
19661966
}
19671967
return m, nil

cmd/dx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func doctorOutput(settings hawkconfig.Settings) string {
8888
if f, err := os.Create(testFile); err != nil {
8989
writable = "not writable"
9090
} else {
91-
f.Close()
91+
_ = f.Close()
9292
_ = os.Remove(testFile)
9393
}
9494
entries, _ := os.ReadDir(sessDir)

cmd/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ func panicRecovery(saveFn func()) {
202202

203203
f, err := os.OpenFile(crashLog, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
204204
if err == nil {
205-
f.WriteString(entry)
206-
f.Close()
205+
_, _ = f.WriteString(entry)
206+
_ = f.Close()
207207
}
208208
}
209209

0 commit comments

Comments
 (0)