Skip to content

Commit a022547

Browse files
committed
fix: enable recvcheck linter
1 parent 776e96e commit a022547

File tree

6 files changed

+23
-20
lines changed

6 files changed

+23
-20
lines changed

.golangci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ linters:
1919
- nestif
2020
- paralleltest
2121
- predeclared
22-
- recvcheck
2322
- revive
2423
- whitespace
2524
- wrapcheck

internal/manager/strategies.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ const (
2121
PreventRefresh
2222
)
2323

24-
func (r RefreshStrategy) String() string {
25-
switch r {
24+
func (r *RefreshStrategy) String() string {
25+
switch *r {
2626
case AutoRefresh:
2727
return "auto"
2828
case ForceRefresh:
@@ -37,8 +37,8 @@ func (r *RefreshStrategy) Allowed() string {
3737
return "auto, force, prevent"
3838
}
3939

40-
func (r RefreshStrategy) ShouldRefresh(expired bool) bool {
41-
switch r {
40+
func (r *RefreshStrategy) ShouldRefresh(expired bool) bool {
41+
switch *r {
4242

4343
case ForceRefresh:
4444
slog.Info("forcing a refresh")
@@ -71,7 +71,7 @@ func (r *RefreshStrategy) Set(value string) error {
7171
return nil
7272
}
7373

74-
func (r RefreshStrategy) Type() string {
74+
func (r *RefreshStrategy) Type() string {
7575
return "RefreshStrategy"
7676
}
7777

@@ -92,11 +92,11 @@ const (
9292
ForceEnrich
9393
)
9494

95-
func (r ForceStrategy) Has(s ForceStrategy) bool {
96-
return r&s != 0
95+
func (r *ForceStrategy) Has(s ForceStrategy) bool {
96+
return *r&s != 0
9797
}
9898

99-
func (r ForceStrategy) String() string {
99+
func (r *ForceStrategy) String() string {
100100
s := []string{}
101101

102102
if r.Has(ForceApply) {
@@ -114,7 +114,7 @@ func (r ForceStrategy) String() string {
114114
return strings.Join(s, ", ")
115115
}
116116

117-
func (r ForceStrategy) Allowed() string {
117+
func (r *ForceStrategy) Allowed() string {
118118
return "apply, noop, enrich"
119119
}
120120

@@ -137,6 +137,6 @@ func (r *ForceStrategy) Set(value string) error {
137137
return nil
138138
}
139139

140-
func (r ForceStrategy) Type() string {
140+
func (r *ForceStrategy) Type() string {
141141
return "ForceStrategy"
142142
}

internal/repl/handlers.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (CleanListMsg) apply(m model) (tea.Model, tea.Cmd) {
5151
)
5252
}
5353

54-
func (m *model) handleCommand(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
54+
func (m model) handleCommand(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
5555
switch {
5656
case key.Matches(msg, m.keymap.CommandAccept):
5757
return m.acceptCommand()
@@ -65,7 +65,7 @@ func (m *model) handleCommand(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
6565
return m, cmd
6666
}
6767

68-
func (m *model) handleResult(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
68+
func (m model) handleResult(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
6969
switch {
7070

7171
case key.Matches(msg, m.list.KeyMap.ShowFullHelp):
@@ -82,7 +82,7 @@ func (m *model) handleResult(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
8282
return m, cmd
8383
}
8484

85-
func (m *model) handleBrowsing(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
85+
func (m model) handleBrowsing(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
8686
slog.Debug("browsing", "key", msg.String())
8787

8888
switch {
@@ -136,7 +136,7 @@ func (m model) setIndexes() tea.Cmd {
136136
return tea.Batch(cmds...)
137137
}
138138

139-
func (m *model) handleFiltering(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
139+
func (m model) handleFiltering(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
140140
slog.Debug("filtering", "key", msg.String())
141141

142142
var cmd tea.Cmd

internal/repl/keymap.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (k Keymap) FullHelp() [][]key.Binding {
2828
}
2929
}
3030

31-
func (m *model) initKeymap(keymap config.Keymap) {
31+
func (m model) initKeymap(keymap config.Keymap) model {
3232
m.keymap = Keymap{
3333
Toggle: keymap.Binding("normal", "toggle selected"),
3434
All: keymap.Binding("normal", "select all"),
@@ -62,6 +62,8 @@ func (m *model) initKeymap(keymap config.Keymap) {
6262
PageDown: keymap.Binding("normal", "next page"),
6363
PageUp: keymap.Binding("normal", "previous page"),
6464
}
65+
66+
return m
6567
}
6668

6769
type ViewportKeymap struct {

internal/repl/repl.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func Init(n notifications.Notifications, actions actions.ActionsMap, keymap conf
4747
}
4848

4949
m.list.SetItems(items)
50-
m.initView()
51-
m.initKeymap(keymap)
50+
m = m.initView()
51+
m = m.initKeymap(keymap)
5252

5353
if _, err := tea.NewProgram(m).Run(); err != nil {
5454
return err

internal/repl/view.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
var noStyle = lipgloss.NewStyle()
1414

15-
func (m *model) initView() {
15+
func (m model) initView() model {
1616
m.list.SetShowStatusBar(false)
1717
m.list.SetShowTitle(false)
1818
m.list.SetShowFilter(false)
@@ -48,9 +48,11 @@ func (m *model) initView() {
4848

4949
m.command.SetSuggestions(suggestions)
5050
m.command.ShowSuggestions = true
51+
52+
return m
5153
}
5254

53-
func (m *model) handleResize(msg tea.WindowSizeMsg) (tea.Model, tea.Cmd) {
55+
func (m model) handleResize(msg tea.WindowSizeMsg) (tea.Model, tea.Cmd) {
5456
slog.Debug("resize", "width", msg.Width, "height", msg.Height)
5557

5658
m.list.SetHeight(min(msg.Height, m.maxHeight))

0 commit comments

Comments
 (0)