diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2024-05-19 17:22:42 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-19 17:22:42 +1000 |
commit | 9fc7a5177bf3a924527fb7172da8ce9407b65bd2 (patch) | |
tree | a36752dfb1b0e7d572d6c3928cfc4343c9859598 | |
parent | 4404aacdeee788b1f6c3ba5d88a671fbc6d9b8f2 (diff) | |
parent | fdff2dec79c30d45af9d3330907f40ebb75b53d4 (diff) |
Bump go version to 1.22 (#3574)
- **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
-->
43 files changed, 19 insertions, 95 deletions
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0d126d16e..823f2bc80 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,7 +3,7 @@ name: Continuous Delivery on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: @@ -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: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74033166a..c0e472727 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: Continuous Integration env: - GO_VERSION: 1.21 + GO_VERSION: 1.22 on: push: @@ -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: | @@ -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 @@ -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 @@ -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: | @@ -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/golangci-lint-action@v3.7.0 with: @@ -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: diff --git a/.golangci.yml b/.golangci.yml index c8884c93a..85a956508 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -30,5 +30,5 @@ linters-settings: max-func-lines: 0 run: - go: '1.21' + go: '1.22' timeout: 10m diff --git a/Dockerfile b/Dockerfile index 976f2221d..594504468 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -1,6 +1,6 @@ module github.com/jesseduffield/lazygit -go 1.21 +go 1.22 require ( github.com/adrg/xdg v0.4.0 diff --git a/pkg/commands/git_commands/branch_test.go b/pkg/commands/git_commands/branch_test.go index a6082586c..5c58513d0 100644 --- a/pkg/commands/git_commands/branch_test.go +++ b/pkg/commands/git_commands/branch_test.go @@ -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}") @@ -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}) @@ -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) @@ -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})) @@ -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()) diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go index 3c01344d9..737e4c077 100644 --- a/pkg/commands/git_commands/commit_loader.go +++ b/pkg/commands/git_commands/commit_loader.go @@ -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() diff --git a/pkg/commands/git_commands/commit_loader_test.go b/pkg/commands/git_commands/commit_loader_test.go index d9aa8456c..fe4f39585 100644 --- a/pkg/commands/git_commands/commit_loader_test.go +++ b/pkg/commands/git_commands/commit_loader_test.go @@ -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{} diff --git a/pkg/commands/git_commands/commit_test.go b/pkg/commands/git_commands/commit_test.go index 2e36636c5..c3708422e 100644 --- a/pkg/commands/git_commands/commit_test.go +++ b/pkg/commands/git_commands/commit_test.go @@ -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}) @@ -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 @@ -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 @@ -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)) @@ -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) @@ -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 @@ -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), @@ -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}) diff --git a/pkg/commands/git_commands/file_loader_test.go b/pkg/commands/git_commands/file_loader_test.go index f7efe68b8..73fac7ef4 100644 --- a/pkg/commands/git_commands/file_loader_test.go +++ b/pkg/commands/git_commands/file_loader_test.go @@ -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) diff --git a/pkg/commands/git_commands/flow_test.go b/pkg/commands/git_commands/flow_test.go index 21729b5a8..911f50c7e 100644 --- a/pkg/commands/git_commands/flow_test.go +++ b/pkg/commands/git_commands/flow_test.go @@ -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{}) @@ -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), diff --git a/pkg/commands/git_commands/rebase_test.go b/pkg/commands/git_commands/rebase_test.go index 2760abd05..21ebdf365 100644 --- a/pkg/commands/git_commands/rebase_test.go +++ b/pkg/commands/git_commands/rebase_test.go @@ -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)) @@ -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) }) @@ -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, diff --git a/pkg/commands/git_commands/reflog_commit_loader_test.go b/pkg/commands/git_commands/reflog_commit_loader_test.go index ca02f2b51..c9eca3e15 100644 --- a/pkg/commands/git_commands/reflog_commit_loader_test.go +++ b/pkg/commands/git_commands/reflog_commit_loader_test.go @@ -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(), diff --git a/pkg/commands/git_commands/repo_paths_test.go b/pkg/commands/git_commands/repo_paths_test.go index ae4526737..97cfc8119 100644 --- a/pkg/commands/git_commands/repo_paths_test.go +++ b/pkg/commands/git_commands/repo_paths_test.go @@ -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) diff --git a/pkg/commands/git_commands/stash_loader_test.go b/pkg/commands/git_commands/stash_loader_test.go index 393b4d4b9..4f1f171fe 100644 --- a/pkg/commands/git_commands/stash_loader_test.go +++ b/pkg/commands/git_commands/stash_loader_test.go @@ -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) diff --git a/pkg/commands/git_commands/stash_test.go b/pkg/commands/git_commands/stash_test.go index 35b48e42d..accd05890 100644 --- a/pkg/commands/git_commands/stash_test.go +++ b/pkg/commands/git_commands/stash_test.go @@ -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) @@ -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{} @@ -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). diff --git a/pkg/commands/git_commands/sync_test.go b/pkg/commands/git_commands/sync_test.go index 93e6de1b1..f5f281e14 100644 --- a/pkg/commands/git_commands/sync_test.go +++ b/pkg/commands/git_commands/sync_test.go @@ -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() @@ -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 @@ -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 diff --git a/pkg/commands/git_commands/tag_loader_test.go b/pkg/commands/git_commands/tag_loader_test.go index 59c4d0337..1d24e9dd1 100644 --- a/pkg/commands/git_commands/tag_loader_test.go +++ b/pkg/commands/git_commands/tag_loader_test.go @@ -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(), diff --git a/pkg/commands/git_commands/working_tree_test.go b/pkg/commands/git_commands/working_tree_test.go index 435048072..cc0ad55f5 100644 --- a/pkg/commands/git_commands/working_tree_test.go +++ b/pkg/commands/git_commands/working_tree_test.go @@ -61,7 +61,6 @@ func TestWorkingTreeUnstageFile(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) s.test(instance.UnStageFile([]string{"test.txt"}, s.reset)) @@ -190,7 +189,6 @@ func TestWorkingTreeDiscardAllFileChanges(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner, removeFile: s.removeFile}) err := instance.DiscardAllFileChanges(s.file) @@ -306,7 +304,6 @@ func TestWorkingTreeDiff(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { userConfig := config.GetDefaultConfig() appState := &config.AppState{} @@ -375,7 +372,6 @@ func TestWorkingTreeShowFileDiff(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { userConfig := config.GetDefaultConfig() appState := &config.AppState{} @@ -428,7 +424,6 @@ func TestWorkingTreeCheckoutFile(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) @@ -459,7 +454,6 @@ func TestWorkingTreeDiscardUnstagedFileChanges(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) s.test(instance.DiscardUnstagedFileChanges(s.file)) @@ -487,7 +481,6 @@ func TestWorkingTreeDiscardAnyUnstagedFileChanges(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) s.test(instance.DiscardAnyUnstagedFileChanges()) @@ -515,7 +508,6 @@ func TestWorkingTreeRemoveUntrackedFiles(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) s.test(instance.RemoveUntrackedFiles()) @@ -545,7 +537,6 @@ func TestWorkingTreeResetHard(t *testing.T) { } for _, s := range scenarios { - s := s t.Run(s.testName, func(t *testing.T) { instance := buildWorkingTreeCommands(commonDeps{runner: s.runner}) s.test(instance.ResetHard(s.ref)) diff --git a/pkg/commands/git_commands/worktree_loader.go b/pkg/commands/git_commands/worktree_loader.go index 97839662c..a6c39dbce 100644 --- a/pkg/commands/git_commands/worktree_loader.go +++ b/pkg/commands/git_commands/worktree_loader.go @@ -76,8 +76,6 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) { wg := sync.WaitGroup{} wg.Add(len(worktrees)) for _, worktree := range worktrees { - worktree := worktree - go utils.Safe(func() { defer wg.Done() diff --git a/pkg/commands/git_commands/worktree_loader_test.go b/pkg/commands/git_commands/worktree_loader_test.go index 02ed73e86..ba462729f 100644 --- a/pkg/commands/git_commands/worktree_loader_test.go +++ b/pkg/commands/git_commands/worktree_loader_test.go @@ -181,7 +181,6 @@ branch refs/heads/mybranch-worktree } for _, s := range scena |