Skip to content

Commit 27204b5

Browse files
committed
run make fix
1 parent b5b1c47 commit 27204b5

File tree

5 files changed

+27
-32
lines changed

5 files changed

+27
-32
lines changed

cmd/goose/deadlock_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestConcurrentMenuOperations(t *testing.T) {
4242
}()
4343

4444
// Simulate concurrent menu clicks (write lock operations)
45-
for i := 0; i < concurrentOps; i++ {
45+
for range concurrentOps {
4646
go func() {
4747
defer wg.Done()
4848

@@ -55,7 +55,7 @@ func TestConcurrentMenuOperations(t *testing.T) {
5555
}
5656

5757
// Simulate concurrent menu generation (read lock operations)
58-
for i := 0; i < concurrentOps; i++ {
58+
for range concurrentOps {
5959
go func() {
6060
defer wg.Done()
6161

@@ -65,7 +65,7 @@ func TestConcurrentMenuOperations(t *testing.T) {
6565
}
6666

6767
// Simulate concurrent PR updates (write lock operations)
68-
for i := 0; i < concurrentOps; i++ {
68+
for i := range concurrentOps {
6969
go func(iteration int) {
7070
defer wg.Done()
7171

@@ -154,7 +154,7 @@ func TestRapidMenuClicks(t *testing.T) {
154154
clickCount := 20
155155
successfulClicks := 0
156156

157-
for i := 0; i < clickCount; i++ {
157+
for range clickCount {
158158
// Check if enough time has passed for rate limiting
159159
app.mu.RLock()
160160
timeSince := time.Since(app.lastSearchAttempt)

cmd/goose/main.go

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,34 @@ type PR struct {
6464

6565
// App holds the application state.
6666
type App struct {
67+
lastSearchAttempt time.Time
6768
lastSuccessfulFetch time.Time
68-
lastSearchAttempt time.Time // For rate limiting forced refreshes
69-
lastMenuTitles []string // For change detection to prevent unnecessary redraws
7069
startTime time.Time
70+
systrayInterface SystrayInterface
71+
browserRateLimiter *BrowserRateLimiter
72+
blockedPRTimes map[string]time.Time
73+
currentUser *github.User
74+
stateManager *PRStateManager
7175
client *github.Client
76+
hiddenOrgs map[string]bool
77+
seenOrgs map[string]bool
7278
turnClient *turn.Client
73-
currentUser *github.User
74-
stateManager *PRStateManager // NEW: Centralized state management
75-
browserRateLimiter *BrowserRateLimiter
76-
targetUser string
77-
cacheDir string
79+
previousBlockedPRs map[string]bool
7880
authError string
79-
incoming []PR
81+
cacheDir string
82+
targetUser string
83+
lastMenuTitles []string
8084
outgoing []PR
85+
incoming []PR
8186
updateInterval time.Duration
8287
consecutiveFailures int
8388
mu sync.RWMutex
84-
menuInitialized bool
85-
initialLoadComplete bool
86-
enableAudioCues bool
8789
enableAutoBrowser bool
8890
hideStaleIncoming bool
8991
noCache bool
90-
systrayInterface SystrayInterface // For mocking systray operations in tests
91-
hiddenOrgs map[string]bool
92-
seenOrgs map[string]bool
93-
94-
// Deprecated: These fields are kept for backward compatibility with tests
95-
// The actual state is managed by stateManager
96-
previousBlockedPRs map[string]bool // Deprecated: use stateManager
97-
blockedPRTimes map[string]time.Time // Deprecated: use stateManager
92+
enableAudioCues bool
93+
initialLoadComplete bool
94+
menuInitialized bool
9895
}
9996

10097
func loadCurrentUser(ctx context.Context, app *App) {

cmd/goose/menu_item_interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ func (r *RealMenuItem) AddSubMenuItem(title, tooltip string) MenuItem {
6666

6767
// MockMenuItem implements MenuItem for testing without calling systray functions.
6868
type MockMenuItem struct {
69+
clickHandler func()
6970
title string
7071
tooltip string
72+
subItems []MenuItem
7173
disabled bool
7274
checked bool
73-
clickHandler func()
74-
subItems []MenuItem
7575
}
7676

7777
// Ensure MockMenuItem implements MenuItem interface.

cmd/goose/pr_state.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ import (
99

1010
// PRState tracks the complete state of a PR including blocking history.
1111
type PRState struct {
12-
PR PR
1312
FirstBlockedAt time.Time
1413
LastSeenBlocked time.Time
15-
HasNotified bool // Have we already notified about this PR being blocked?
14+
PR PR
15+
HasNotified bool
1616
}
1717

1818
// PRStateManager manages all PR states with proper synchronization.
1919
type PRStateManager struct {
20-
mu sync.RWMutex
21-
states map[string]*PRState // Key is PR URL
22-
23-
// Configuration
2420
startTime time.Time
21+
states map[string]*PRState
2522
gracePeriodSeconds int
23+
mu sync.RWMutex
2624
}
2725

2826
// NewPRStateManager creates a new PR state manager.

cmd/goose/settings.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

1111
// Settings represents persistent user settings.
1212
type Settings struct {
13+
HiddenOrgs map[string]bool `json:"hidden_orgs"`
1314
EnableAudioCues bool `json:"enable_audio_cues"`
1415
HideStale bool `json:"hide_stale"`
1516
EnableAutoBrowser bool `json:"enable_auto_browser"`
16-
HiddenOrgs map[string]bool `json:"hidden_orgs"`
1717
}
1818

1919
// settingsDir returns the configuration directory for settings.

0 commit comments

Comments
 (0)