From fbeb4bfd263477fdf63c595f9f5f86dfd5473cd6 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Wed, 23 Oct 2024 11:03:47 +0300 Subject: [PATCH 1/2] chore: bump go to 1.23 --- CONTRIBUTING.md | 2 +- README.md | 2 +- cmd/add.go | 7 +++---- cmd/run.go | 7 +++---- go.mod | 6 +++--- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5581f935..f6f56f3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ First off, thanks for taking the time to contribute! Feel free to make Pull Requ # Requirements -Go >= 1.22.0 +Go >= 1.23.0 # Process diff --git a/README.md b/README.md index 1ecf8926..ecf545f4 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A Git hooks manager for Node.js, Ruby, Python and many other types of projects. ## Install -With **Go** (>= 1.22): +With **Go** (>= 1.23): ```bash go install github.com/evilmartians/lefthook@latest diff --git a/cmd/add.go b/cmd/add.go index 3b2851e8..1f0178ae 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -2,10 +2,10 @@ package cmd import ( _ "embed" - "sort" + "maps" + "slices" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "github.com/evilmartians/lefthook/internal/config" "github.com/evilmartians/lefthook/internal/lefthook" @@ -24,8 +24,7 @@ func (add) New(opts *lefthook.Options) *cobra.Command { if len(args) != 0 { return } - ret = maps.Keys(config.AvailableHooks) - sort.Strings(ret) + ret = slices.Sorted(maps.Keys(config.AvailableHooks)) return } diff --git a/cmd/run.go b/cmd/run.go index 0fa18e2d..5f52188a 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -1,10 +1,10 @@ package cmd import ( - "sort" + "maps" + "slices" "github.com/spf13/cobra" - "golang.org/x/exp/maps" "github.com/evilmartians/lefthook/internal/config" "github.com/evilmartians/lefthook/internal/lefthook" @@ -22,8 +22,7 @@ func (run) New(opts *lefthook.Options) *cobra.Command { return } ret = lefthook.ConfigHookCompletions(opts) - other := maps.Keys(config.AvailableHooks) - sort.Strings(other) + other := slices.Sorted(maps.Keys(config.AvailableHooks)) ret = append(ret, other...) return } diff --git a/go.mod b/go.mod index 9be6151f..b6fa9383 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/evilmartians/lefthook -go 1.22 +go 1.23 -toolchain go1.22.3 +toolchain go1.23.2 require ( github.com/MakeNowJust/heredoc v1.0.0 @@ -18,6 +18,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 ) @@ -32,7 +33,6 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/tools v0.22.0 // indirect ) From cbf5964adef62cf234a489281f62a155d34ab33e Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Wed, 23 Oct 2024 11:12:49 +0300 Subject: [PATCH 2/2] ci: update golangci-lint --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2f30c5af..35aaada7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,4 +18,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: - version: v1.59.0 + version: v1.61.0