Skip to content

Commit bf6d2a1

Browse files
authored
Update to go 1.24 (#4377)
- **PR Description** Update to go 1.24. This is required to use a newer version of go-git. - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [x] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [x] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [x] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
2 parents 19ac926 + be7583d commit bf6d2a1

File tree

11 files changed

+44
-42
lines changed

11 files changed

+44
-42
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Continuous Integration
22

33
env:
4-
GO_VERSION: 1.22
4+
GO_VERSION: 1.24
55

66
on:
77
push:
@@ -32,7 +32,7 @@ jobs:
3232
- name: Setup Go
3333
uses: actions/setup-go@v5
3434
with:
35-
go-version: 1.22.x
35+
go-version: 1.24.x
3636
- name: Test code
3737
# we're passing -short so that we skip the integration tests, which will be run in parallel below
3838
run: |
@@ -89,7 +89,7 @@ jobs:
8989
- name: Setup Go
9090
uses: actions/setup-go@v5
9191
with:
92-
go-version: 1.22.x
92+
go-version: 1.24.x
9393
- name: Print git version
9494
run: git --version
9595
- name: Test code
@@ -115,7 +115,7 @@ jobs:
115115
- name: Setup Go
116116
uses: actions/setup-go@v5
117117
with:
118-
go-version: 1.22.x
118+
go-version: 1.24.x
119119
- name: Build linux binary
120120
run: |
121121
GOOS=linux go build
@@ -142,7 +142,7 @@ jobs:
142142
- name: Setup Go
143143
uses: actions/setup-go@v5
144144
with:
145-
go-version: 1.22.x
145+
go-version: 1.24.x
146146
- name: Check Vendor Directory
147147
# ensure our vendor directory matches up with our go modules
148148
run: |
@@ -168,11 +168,11 @@ jobs:
168168
- name: Setup Go
169169
uses: actions/setup-go@v5
170170
with:
171-
go-version: 1.22.x
171+
go-version: 1.24.x
172172
- name: Lint
173-
uses: golangci/golangci-lint-action@v6.1.0
173+
uses: golangci/golangci-lint-action@v6.5.0
174174
with:
175-
version: v1.60
175+
version: v1.64.6
176176
- name: errors
177177
run: golangci-lint run
178178
if: ${{ failure() }}
@@ -197,7 +197,7 @@ jobs:
197197
- name: Setup Go
198198
uses: actions/setup-go@v5
199199
with:
200-
go-version: 1.22.x
200+
go-version: 1.24.x
201201

202202
- name: Download all coverage artifacts
203203
uses: actions/download-artifact@v4

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
- name: Setup Go
127127
uses: actions/setup-go@v5
128128
with:
129-
go-version: 1.22.x
129+
go-version: 1.24.x
130130

131131
- name: Run goreleaser
132132
uses: goreleaser/goreleaser-action@v4

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ linters-settings:
3232
max-func-lines: 0
3333

3434
run:
35-
go: '1.22'
35+
go: "1.24"
3636
timeout: 10m

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# docker build -t lazygit .
33
# docker run -it lazygit:latest /bin/sh
44

5-
FROM golang:1.22 as build
5+
FROM golang:1.24 as build
66
WORKDIR /go/src/github.com/jesseduffield/lazygit/
77
COPY go.mod go.sum ./
88
RUN go mod download

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jesseduffield/lazygit
22

3-
go 1.22
3+
go 1.24
44

55
require (
66
github.com/adrg/xdg v0.4.0

pkg/cheatsheet/generate.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
package cheatsheet
1212

1313
import (
14+
"cmp"
1415
"fmt"
1516
"log"
1617
"os"
18+
"slices"
19+
"strings"
1720

1821
"github.com/jesseduffield/generics/maps"
1922
"github.com/jesseduffield/lazycore/pkg/utils"
@@ -23,7 +26,6 @@ import (
2326
"github.com/jesseduffield/lazygit/pkg/gui/types"
2427
"github.com/jesseduffield/lazygit/pkg/i18n"
2528
"github.com/samber/lo"
26-
"golang.org/x/exp/slices"
2729
)
2830

2931
type bindingSection struct {
@@ -164,11 +166,11 @@ func getBindingSections(bindings []*types.Binding, tr *i18n.TranslationSet) []*b
164166
},
165167
)
166168

167-
slices.SortFunc(bindingGroups, func(a, b headerWithBindings) bool {
169+
slices.SortFunc(bindingGroups, func(a, b headerWithBindings) int {
168170
if a.header.priority != b.header.priority {
169-
return a.header.priority > b.header.priority
171+
return cmp.Compare(b.header.priority, a.header.priority)
170172
}
171-
return a.header.title < b.header.title
173+
return strings.Compare(a.header.title, b.header.title)
172174
})
173175

174176
return lo.Map(bindingGroups, func(hb headerWithBindings, _ int) *bindingSection {

pkg/commands/git_commands/branch_loader.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package git_commands
33
import (
44
"fmt"
55
"regexp"
6+
"slices"
67
"strconv"
78
"strings"
89
"time"
@@ -14,7 +15,6 @@ import (
1415
"github.com/jesseduffield/lazygit/pkg/common"
1516
"github.com/jesseduffield/lazygit/pkg/utils"
1617
"github.com/samber/lo"
17-
"golang.org/x/exp/slices"
1818
"golang.org/x/sync/errgroup"
1919
)
2020

@@ -95,8 +95,8 @@ func (self *BranchLoader) Load(reflogCommits []*models.Commit,
9595

9696
// Sort branches that don't have a recency value alphabetically
9797
// (we're really doing this for the sake of deterministic behaviour across git versions)
98-
slices.SortFunc(branches, func(a *models.Branch, b *models.Branch) bool {
99-
return a.Name < b.Name
98+
slices.SortFunc(branches, func(a *models.Branch, b *models.Branch) int {
99+
return strings.Compare(a.Name, b.Name)
100100
})
101101

102102
branches = utils.Prepend(branches, branchesWithRecency...)

pkg/commands/git_commands/remote_loader.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package git_commands
22

33
import (
44
"fmt"
5+
"slices"
56
"strings"
67
"sync"
78

@@ -11,7 +12,6 @@ import (
1112
"github.com/jesseduffield/lazygit/pkg/common"
1213
"github.com/jesseduffield/lazygit/pkg/utils"
1314
"github.com/samber/lo"
14-
"golang.org/x/exp/slices"
1515
)
1616

1717
type RemoteLoader struct {
@@ -67,15 +67,15 @@ func (self *RemoteLoader) GetRemotes() ([]*models.Remote, error) {
6767
})
6868

6969
// now lets sort our remotes by name alphabetically
70-
slices.SortFunc(remotes, func(a, b *models.Remote) bool {
70+
slices.SortFunc(remotes, func(a, b *models.Remote) int {
7171
// we want origin at the top because we'll be most likely to want it
7272
if a.Name == "origin" {
73-
return true
73+
return -1
7474
}
7575
if b.Name == "origin" {
76-
return false
76+
return 1
7777
}
78-
return strings.ToLower(a.Name) < strings.ToLower(b.Name)
78+
return strings.Compare(strings.ToLower(a.Name), strings.ToLower(b.Name))
7979
})
8080

8181
return remotes, nil

pkg/gui/controllers/helpers/window_arrangement_helper_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package helpers
22

33
import (
4+
"cmp"
45
"fmt"
6+
"slices"
57
"strings"
68
"testing"
79

810
"github.com/jesseduffield/lazycore/pkg/boxlayout"
911
"github.com/jesseduffield/lazygit/pkg/config"
1012
"github.com/jesseduffield/lazygit/pkg/gui/types"
1113
"github.com/samber/lo"
12-
"golang.org/x/exp/slices"
1314
)
1415

1516
// The best way to add test cases here is to set your args and then get the
@@ -490,16 +491,13 @@ func renderLayout(windows map[string]boxlayout.Dimensions) string {
490491
// Sort first by name, then by position. This means our short labels will
491492
// increment in the order that the windows appear on the screen.
492493
slices.Sort(windowNames)
493-
slices.SortStableFunc(windowNames, func(a, b string) bool {
494+
slices.SortStableFunc(windowNames, func(a, b string) int {
494495
dimensionsA := windows[a]
495496
dimensionsB := windows[b]
496-
if dimensionsA.Y0 < dimensionsB.Y0 {
497-
return true
497+
if dimensionsA.Y0 != dimensionsB.Y0 {
498+
return cmp.Compare(dimensionsA.Y0, dimensionsB.Y0)
498499
}
499-
if dimensionsA.Y0 > dimensionsB.Y0 {
500-
return false
501-
}
502-
return dimensionsA.X0 < dimensionsB.X0
500+
return cmp.Compare(dimensionsA.X0, dimensionsB.X0)
503501
})
504502

505503
// Uniquify windows by dimensions (so perfectly overlapping windows are de-duped). This prevents getting 'fileshes' as a label where the files and branches windows overlap.

pkg/gui/filetree/node.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package filetree
22

33
import (
44
"path"
5+
"slices"
6+
"strings"
57

68
"github.com/jesseduffield/lazygit/pkg/commands/models"
79
"github.com/jesseduffield/lazygit/pkg/gui/types"
810
"github.com/samber/lo"
9-
"golang.org/x/exp/slices"
1011
)
1112

1213
// Represents a file or directory in a file tree.
@@ -80,15 +81,15 @@ func (self *Node[T]) SortChildren() {
8081

8182
children := slices.Clone(self.Children)
8283

83-
slices.SortFunc(children, func(a, b *Node[T]) bool {
84+
slices.SortFunc(children, func(a, b *Node[T]) int {
8485
if !a.IsFile() && b.IsFile() {
85-
return true
86+
return -1
8687
}
8788
if a.IsFile() && !b.IsFile() {
88-
return false
89+
return 1
8990
}
9091

91-
return a.GetPath() < b.GetPath()
92+
return strings.Compare(a.GetPath(), b.GetPath())
9293
})
9394

9495
// TODO: think about making this in-place

0 commit comments

Comments
 (0)