Skip to content

Commit

Permalink
Bump go version to 1.22 (#3574)
Browse files Browse the repository at this point in the history
- **PR Description**

Bumps go from 1.21 to 1.22, and removes newly redundant loop variable
re-declarations now that in 1.22 the variables are automatically
redeclared in each iteration for us.

- **Please check if the PR fulfills these requirements**

* [ ] Cheatsheets are up-to-date (run `go generate ./...`)
* [ ] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [ ] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [ ] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [ ] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [ ] You've read through your own file changes for silly mistakes etc

<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
  • Loading branch information
jesseduffield committed May 19, 2024
2 parents 4404aac + fdff2de commit 9fc7a51
Show file tree
Hide file tree
Showing 43 changed files with 19 additions and 95 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Delivery
on:
push:
tags:
- 'v*'
- "v*"

jobs:
goreleaser:
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Continuous Integration

env:
GO_VERSION: 1.21
GO_VERSION: 1.22

on:
push:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Test code
# we're passing -short so that we skip the integration tests, which will be run in parallel below
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Print git version
run: git --version
- name: Test code
Expand All @@ -115,7 +115,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Build linux binary
run: |
GOOS=linux go build
Expand All @@ -142,7 +142,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Check Vendor Directory
# ensure our vendor directory matches up with our go modules
run: |
Expand All @@ -168,7 +168,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.22.x
- name: Lint
uses: golangci/[email protected]
with:
Expand All @@ -194,6 +194,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x

- name: Download all coverage artifacts
uses: actions/download-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ linters-settings:
max-func-lines: 0

run:
go: '1.21'
go: '1.22'
timeout: 10m
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build -t lazygit .
# docker run -it lazygit:latest /bin/sh

FROM golang:1.21 as build
FROM golang:1.22 as build
WORKDIR /go/src/github.com/jesseduffield/lazygit/
COPY go.mod go.sum ./
RUN go mod download
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jesseduffield/lazygit

go 1.21
go 1.22

require (
github.com/adrg/xdg v0.4.0
Expand Down
5 changes: 0 additions & 5 deletions pkg/commands/git_commands/branch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func TestBranchGetCommitDifferences(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildBranchCommands(commonDeps{runner: s.runner})
pushables, pullables := instance.GetCommitDifferences("HEAD", "@{u}")
Expand Down Expand Up @@ -89,7 +88,6 @@ func TestBranchDeleteBranch(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildBranchCommands(commonDeps{runner: s.runner})

Expand Down Expand Up @@ -150,7 +148,6 @@ func TestBranchMerge(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
runner := oscommands.NewFakeRunner(t).
ExpectGitArgs(s.expected, "", nil)
Expand Down Expand Up @@ -190,7 +187,6 @@ func TestBranchCheckout(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildBranchCommands(commonDeps{runner: s.runner})
s.test(instance.Checkout("test", CheckoutOptions{Force: s.force}))
Expand Down Expand Up @@ -279,7 +275,6 @@ func TestBranchCurrentBranchInfo(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildBranchCommands(commonDeps{runner: s.runner})
s.test(instance.CurrentBranchInfo())
Expand Down
2 changes: 0 additions & 2 deletions pkg/commands/git_commands/commit_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,6 @@ func (self *CommitLoader) getExistingMainBranches() []string {

for i, branchName := range mainBranches {
wg.Add(1)
i := i
branchName := branchName
go utils.Safe(func() {
defer wg.Done()

Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/commit_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ func TestGetCommits(t *testing.T) {
}

for _, scenario := range scenarios {
scenario := scenario
t.Run(scenario.testName, func(t *testing.T) {
common := utils.NewDummyCommon()
common.AppState = &config.AppState{}
Expand Down
8 changes: 0 additions & 8 deletions pkg/commands/git_commands/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func TestCommitRewordCommit(t *testing.T) {
},
}
for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildCommitCommands(commonDeps{runner: s.runner})

Expand Down Expand Up @@ -100,7 +99,6 @@ func TestCommitCommitCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
userConfig := config.GetDefaultConfig()
userConfig.Git.Commit.SignOff = s.configSignoff
Expand Down Expand Up @@ -136,7 +134,6 @@ func TestCommitCommitEditorCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
userConfig := config.GetDefaultConfig()
userConfig.Git.Commit.SignOff = s.configSignoff
Expand Down Expand Up @@ -171,7 +168,6 @@ func TestCommitCreateFixupCommit(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildCommitCommands(commonDeps{runner: s.runner})
s.test(instance.CreateFixupCommit(s.hash))
Expand Down Expand Up @@ -221,7 +217,6 @@ func TestCommitCreateAmendCommit(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildCommitCommands(commonDeps{runner: s.runner})
err := instance.CreateAmendCommit(s.originalSubject, s.newSubject, s.newDescription, s.includeFileChanges)
Expand Down Expand Up @@ -285,7 +280,6 @@ func TestCommitShowCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
userConfig := config.GetDefaultConfig()
userConfig.Git.Paging.ExternalDiffCommand = s.extDiffCmd
Expand Down Expand Up @@ -334,7 +328,6 @@ func TestGetCommitMsg(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildCommitCommands(commonDeps{
runner: oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "deadbeef"}, s.input, nil),
Expand Down Expand Up @@ -374,7 +367,6 @@ func TestGetCommitMessageFromHistory(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildCommitCommands(commonDeps{runner: s.runner})

Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/file_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func TestFileGetStatusFiles(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)

Expand Down
2 changes: 0 additions & 2 deletions pkg/commands/git_commands/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestStartCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildFlowCommands(commonDeps{})

Expand Down Expand Up @@ -69,7 +68,6 @@ func TestFinishCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildFlowCommands(commonDeps{
gitConfig: git_config.NewFakeGitConfig(s.gitConfigMockResponses),
Expand Down
3 changes: 0 additions & 3 deletions pkg/commands/git_commands/rebase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func TestRebaseRebaseBranch(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildRebaseCommands(commonDeps{runner: s.runner, gitVersion: s.gitVersion})
s.test(instance.RebaseBranch(s.arg))
Expand All @@ -89,7 +88,6 @@ func TestRebaseSkipEditorCommand(t *testing.T) {
`^GIT_SEQUENCE_EDITOR=.*$`,
"^" + daemon.DaemonKindEnvKey + "=" + strconv.Itoa(int(daemon.DaemonKindExitImmediately)) + "$",
} {
regexStr := regexStr
foundMatch := lo.ContainsBy(envVars, func(envVar string) bool {
return regexp.MustCompile(regexStr).MatchString(envVar)
})
Expand Down Expand Up @@ -163,7 +161,6 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildRebaseCommands(commonDeps{
runner: s.runner,
Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/reflog_commit_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func TestGetReflogCommits(t *testing.T) {
}

for _, scenario := range scenarios {
scenario := scenario
t.Run(scenario.testName, func(t *testing.T) {
builder := &ReflogCommitLoader{
Common: utils.NewDummyCommon(),
Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/repo_paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func TestGetRepoPaths(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.Name, func(t *testing.T) {
runner := oscommands.NewFakeRunner(t)
cmd := oscommands.NewDummyCmdObjBuilder(runner)
Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/stash_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func TestGetStashEntries(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)

Expand Down
3 changes: 0 additions & 3 deletions pkg/commands/git_commands/stash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func TestStashStore(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
runner := oscommands.NewFakeRunner(t).
ExpectGitArgs(s.expected, "", nil)
Expand Down Expand Up @@ -131,7 +130,6 @@ func TestStashStashEntryCmdObj(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
userConfig := config.GetDefaultConfig()
appState := &config.AppState{}
Expand Down Expand Up @@ -181,7 +179,6 @@ func TestStashRename(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
runner := oscommands.NewFakeRunner(t).
ExpectGitArgs(s.expectedHashCmd, s.hashResult, nil).
Expand Down
3 changes: 0 additions & 3 deletions pkg/commands/git_commands/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func TestSyncPush(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildSyncCommands(commonDeps{})
task := gocui.NewFakeTask()
Expand Down Expand Up @@ -124,7 +123,6 @@ func TestSyncFetch(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildSyncCommands(commonDeps{})
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
Expand Down Expand Up @@ -163,7 +161,6 @@ func TestSyncFetchBackground(t *testing.T) {
}

for _, s := range scenarios {
s := s
t.Run(s.testName, func(t *testing.T) {
instance := buildSyncCommands(commonDeps{})
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
Expand Down
1 change: 0 additions & 1 deletion pkg/commands/git_commands/tag_loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestGetTags(t *testing.T) {
}

for _, scenario := range scenarios {
scenario := scenario
t.Run(scenario.testName, func(t *testing.T) {
loader := &TagLoader{
Common: utils.NewDummyCommon(),
Expand Down

0 comments on commit 9fc7a51

Please sign in to comment.