summaryrefslogtreecommitdiffstats
path: root/pkg/cheatsheet
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-24 13:06:42 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:51:23 +1000
commite33fe37a99d4b3866970b1b2f40169d1bc9afa2e (patch)
tree0027f612fb72b2603044d04389da0236df28d864 /pkg/cheatsheet
parentea54cb6e9c07ebca4a53e691fcb3cf993c793a50 (diff)
Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one for consistency. Lo is more extensive and better maintained so we're going with that. My slices package was a superset of go's own slices package so in some places I've just used the official one (the methods were just wrappers anyway). I've also moved the remaining methods into the utils package.
Diffstat (limited to 'pkg/cheatsheet')
-rw-r--r--pkg/cheatsheet/generate.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/cheatsheet/generate.go b/pkg/cheatsheet/generate.go
index 112e4c4d5..184e84a04 100644
--- a/pkg/cheatsheet/generate.go
+++ b/pkg/cheatsheet/generate.go
@@ -15,7 +15,6 @@ import (
"strings"
"github.com/jesseduffield/generics/maps"
- "github.com/jesseduffield/generics/slices"
"github.com/jesseduffield/lazycore/pkg/utils"
"github.com/jesseduffield/lazygit/pkg/app"
"github.com/jesseduffield/lazygit/pkg/config"
@@ -23,6 +22,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/gui/types"
"github.com/jesseduffield/lazygit/pkg/i18n"
"github.com/samber/lo"
+ "golang.org/x/exp/slices"
)
type bindingSection struct {
@@ -129,7 +129,7 @@ func localisedTitle(tr *i18n.TranslationSet, str string) string {
func getBindingSections(bindings []*types.Binding, tr *i18n.TranslationSet) []*bindingSection {
excludedViews := []string{"stagingSecondary", "patchBuildingSecondary"}
- bindingsToDisplay := slices.Filter(bindings, func(binding *types.Binding) bool {
+ bindingsToDisplay := lo.Filter(bindings, func(binding *types.Binding, _ int) bool {
if lo.Contains(excludedViews, binding.ViewName) {
return false
}
@@ -162,7 +162,7 @@ func getBindingSections(bindings []*types.Binding, tr *i18n.TranslationSet) []*b
return a.header.title < b.header.title
})
- return slices.Map(bindingGroups, func(hb headerWithBindings) *bindingSection {
+ return lo.Map(bindingGroups, func(hb headerWithBindings, _ int) *bindingSection {
return &bindingSection{
title: hb.header.title,
bindings: hb.bindings,