on main help sign in
chore: lint
commit5ba54bc7eecd509a39d12270eafac37450e9a64f authorKujtim Hoxha <kujtimii.h@gmail.com> dateThu 24 Jul 2025, 22:21 (1 year ago) parent4614a6c
3 files changed+32−33
internal/csync/slices_test.go+31−31 internal/tui/exp/list/filterable.go+1−1 internal/tui/exp/list/list.go−1
internal/csync/slices_test.go+31−31
@@ -98,7 +98,7 @@ func TestSlice(t *testing.T) {
9898 original := []int{1, 2, 3}
9999 s := NewSliceFrom(original)
100100 assert.Equal(t, 3, s.Len())
101−
101+
102102 // Verify it's a copy, not a reference
103103 original[0] = 999
104104 val, ok := s.Get(0)
@@ -110,12 +110,12 @@ func TestSlice(t *testing.T) {
110110 s := NewSlice[string]()
111111 s.Append("hello")
112112 s.Append("world")
113−
113+
114114 assert.Equal(t, 2, s.Len())
115115 val, ok := s.Get(0)
116116 require.True(t, ok)
117117 assert.Equal(t, "hello", val)
118−
118+
119119 val, ok = s.Get(1)
120120 require.True(t, ok)
121121 assert.Equal(t, "world", val)
@@ -125,12 +125,12 @@ func TestSlice(t *testing.T) {
125125 s := NewSlice[string]()
126126 s.Append("world")
127127 s.Prepend("hello")
128−
128+
129129 assert.Equal(t, 2, s.Len())
130130 val, ok := s.Get(0)
131131 require.True(t, ok)
132132 assert.Equal(t, "hello", val)
133−
133+
134134 val, ok = s.Get(1)
135135 require.True(t, ok)
136136 assert.Equal(t, "world", val)
@@ -138,21 +138,21 @@ func TestSlice(t *testing.T) {
138138
139139 t.Run("Delete", func(t *testing.T) {
140140 s := NewSliceFrom([]int{1, 2, 3, 4, 5})
141−
141+
142142 // Delete middle element
143143 ok := s.Delete(2)
144144 assert.True(t, ok)
145145 assert.Equal(t, 4, s.Len())
146−
146+
147147 expected := []int{1, 2, 4, 5}
148148 actual := s.Slice()
149149 assert.Equal(t, expected, actual)
150−
150+
151151 // Delete out of bounds
152152 ok = s.Delete(10)
153153 assert.False(t, ok)
154154 assert.Equal(t, 4, s.Len())
155−
155+
156156 // Delete negative index
157157 ok = s.Delete(-1)
158158 assert.False(t, ok)
@@ -161,15 +161,15 @@ func TestSlice(t *testing.T) {
161161
162162 t.Run("Get", func(t *testing.T) {
163163 s := NewSliceFrom([]string{"a", "b", "c"})
164−
164+
165165 val, ok := s.Get(1)
166166 require.True(t, ok)
167167 assert.Equal(t, "b", val)
168−
168+
169169 // Out of bounds
170170 _, ok = s.Get(10)
171171 assert.False(t, ok)
172−
172+
173173 // Negative index
174174 _, ok = s.Get(-1)
175175 assert.False(t, ok)
@@ -177,18 +177,18 @@ func TestSlice(t *testing.T) {
177177
178178 t.Run("Set", func(t *testing.T) {
179179 s := NewSliceFrom([]string{"a", "b", "c"})
180−
180+
181181 ok := s.Set(1, "modified")
182182 assert.True(t, ok)
183−
183+
184184 val, ok := s.Get(1)
185185 require.True(t, ok)
186186 assert.Equal(t, "modified", val)
187−
187+
188188 // Out of bounds
189189 ok = s.Set(10, "invalid")
190190 assert.False(t, ok)
191−
191+
192192 // Negative index
193193 ok = s.Set(-1, "invalid")
194194 assert.False(t, ok)
@@ -198,13 +198,13 @@ func TestSlice(t *testing.T) {
198198 s := NewSlice[int]()
199199 s.Append(1)
200200 s.Append(2)
201−
201+
202202 newItems := []int{10, 20, 30}
203203 s.SetSlice(newItems)
204−
204+
205205 assert.Equal(t, 3, s.Len())
206206 assert.Equal(t, newItems, s.Slice())
207−
207+
208208 // Verify it's a copy
209209 newItems[0] = 999
210210 val, ok := s.Get(0)
@@ -215,7 +215,7 @@ func TestSlice(t *testing.T) {
215215 t.Run("Clear", func(t *testing.T) {
216216 s := NewSliceFrom([]int{1, 2, 3})
217217 assert.Equal(t, 3, s.Len())
218−
218+
219219 s.Clear()
220220 assert.Equal(t, 0, s.Len())
221221 })
@@ -223,10 +223,10 @@ func TestSlice(t *testing.T) {
223223 t.Run("Slice", func(t *testing.T) {
224224 original := []int{1, 2, 3}
225225 s := NewSliceFrom(original)
226−
226+
227227 copy := s.Slice()
228228 assert.Equal(t, original, copy)
229−
229+
230230 // Verify it's a copy
231231 copy[0] = 999
232232 val, ok := s.Get(0)
@@ -236,25 +236,25 @@ func TestSlice(t *testing.T) {
236236
237237 t.Run("Seq", func(t *testing.T) {
238238 s := NewSliceFrom([]int{1, 2, 3})
239−
239+
240240 var result []int
241241 for v := range s.Seq() {
242242 result = append(result, v)
243243 }
244−
244+
245245 assert.Equal(t, []int{1, 2, 3}, result)
246246 })
247247
248248 t.Run("SeqWithIndex", func(t *testing.T) {
249249 s := NewSliceFrom([]string{"a", "b", "c"})
250−
250+
251251 var indices []int
252252 var values []string
253253 for i, v := range s.SeqWithIndex() {
254254 indices = append(indices, i)
255255 values = append(values, v)
256256 }
257−
257+
258258 assert.Equal(t, []int{0, 1, 2}, indices)
259259 assert.Equal(t, []string{"a", "b", "c"}, values)
260260 })
@@ -263,9 +263,9 @@ func TestSlice(t *testing.T) {
263263 s := NewSlice[int]()
264264 const numGoroutines = 100
265265 const itemsPerGoroutine = 10
266−
266+
267267 var wg sync.WaitGroup
268−
268+
269269 // Concurrent appends
270270 for i := 0; i < numGoroutines; i++ {
271271 wg.Add(1)
@@ -276,7 +276,7 @@ func TestSlice(t *testing.T) {
276276 }
277277 }(i)
278278 }
279−
279+
280280 // Concurrent reads
281281 for i := 0; i < numGoroutines; i++ {
282282 wg.Add(1)
@@ -287,9 +287,9 @@ func TestSlice(t *testing.T) {
287287 }
288288 }()
289289 }
290−
290+
291291 wg.Wait()
292−
292+
293293 // Should have all items
294294 assert.Equal(t, numGoroutines*itemsPerGoroutine, s.Len())
295295 })
internal/tui/exp/list/filterable.go+1−1
@@ -265,7 +265,7 @@ func (f *filterableList[T]) Filter(query string) tea.Cmd {
265265 matchedItems = append(matchedItems, item)
266266 }
267267
268− if f.list.direction == DirectionBackward {
268+ if f.direction == DirectionBackward {
269269 slices.Reverse(matchedItems)
270270 }
271271
internal/tui/exp/list/list.go−1
@@ -846,7 +846,6 @@ func (l *list[T]) SelectItemAbove() tea.Cmd {
846846 cmds = append(cmds, cmd)
847847 }
848848 }
849−
850849 }
851850 item, ok := l.items.Get(newIndex)
852851 if !ok {