Skip to content

Commit 48a43d1

Browse files
jongioCopilot
andcommitted
fix: satisfy staticcheck and errcheck in live-activity code
LastSessionEvent built SessionEvent field-by-field from an identical struct (staticcheck S1016); use a direct conversion instead. Also explicitly discard the return values of the Win32 syscall wrappers in focus_windows.go, which errcheck flags when linting on Windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dac50159-d2c8-4ade-920a-333a51fc9ce3
1 parent 08be397 commit 48a43d1

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎internal/data/attention.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func LastSessionEvent(sessionID string) SessionEvent {
348348
if err != nil {
349349
return SessionEvent{}
350350
}
351-
return SessionEvent{Type: evt.Type, Timestamp: evt.Timestamp}
351+
return SessionEvent(evt)
352352
}
353353

354354
// readLastEvent reads the last complete JSON line from an events.jsonl file

‎internal/platform/focus_windows.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func FocusSessionWindow(pid int) error {
6464
// Restore if minimized, then bring to foreground.
6565
visible, _, _ := procIsWindowVisible.Call(hwnd)
6666
if visible == 0 {
67-
procShowWindow.Call(hwnd, uintptr(swRestore))
67+
_, _, _ = procShowWindow.Call(hwnd, uintptr(swRestore))
6868
}
6969
ret, _, _ := procSetForegroundWindow.Call(hwnd)
7070
if ret == 0 {
@@ -80,7 +80,7 @@ func buildAncestorSet(targetPID uint32) map[uint32]struct{} {
8080
if snapshot == uintptr(windows.InvalidHandle) {
8181
return nil
8282
}
83-
defer windows.CloseHandle(windows.Handle(snapshot))
83+
defer func() { _ = windows.CloseHandle(windows.Handle(snapshot)) }()
8484

8585
// Build a child->parent map.
8686
parentMap := make(map[uint32]uint32)
@@ -123,7 +123,7 @@ func findWindowForPIDs(pids map[uint32]struct{}) uintptr {
123123
// The callback receives each top-level window handle.
124124
cb := windows.NewCallback(func(hwnd uintptr, lparam uintptr) uintptr {
125125
var winPID uint32
126-
procGetWindowThreadPID.Call(hwnd, uintptr(unsafe.Pointer(&winPID)))
126+
_, _, _ = procGetWindowThreadPID.Call(hwnd, uintptr(unsafe.Pointer(&winPID)))
127127
if _, ok := pids[winPID]; ok {
128128
visible, _, _ := procIsWindowVisible.Call(hwnd)
129129
if visible != 0 {
@@ -134,6 +134,6 @@ func findWindowForPIDs(pids map[uint32]struct{}) uintptr {
134134
return 1 // continue
135135
})
136136

137-
procEnumWindows.Call(cb, 0)
137+
_, _, _ = procEnumWindows.Call(cb, 0)
138138
return found
139139
}

0 commit comments

Comments
 (0)