diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c9a48320..ab9d4d6b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,4 +18,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.53.3 + version: v1.54.1 diff --git a/.golangci.yml b/.golangci.yml index 3774c5b5..5e7f3bc4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,6 +5,10 @@ linters-settings: locale: US gci: local-prefixes: github.com/evilmartians/lefthook + revive: + rules: + - name: unused-parameter + disabled: true linters: disable-all: true diff --git a/Makefile b/Makefile index ea4e85c6..6c8fc21e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ bench: bin/golangci-lint: @test -x $$(go env GOPATH)/bin/golangci-lint || \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.53.3 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.54.1 lint: bin/golangci-lint $$(go env GOPATH)/bin/golangci-lint run diff --git a/cmd/version.go b/cmd/version.go index bf475f59..dfd8b34a 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -8,7 +8,7 @@ import ( "github.com/evilmartians/lefthook/internal/version" ) -func newVersionCmd(opts *lefthook.Options) *cobra.Command { +func newVersionCmd(_opts *lefthook.Options) *cobra.Command { var verbose bool versionCmd := cobra.Command{ diff --git a/internal/lefthook/lefthook.go b/internal/lefthook/lefthook.go index 75f78342..465a1028 100644 --- a/internal/lefthook/lefthook.go +++ b/internal/lefthook/lefthook.go @@ -90,11 +90,7 @@ func (l *Lefthook) cleanHook(hook string, force bool) error { // Just remove lefthook hook if l.isLefthookFile(hookPath) { - if err = l.Fs.Remove(hookPath); err != nil { - return err - } - - return nil + return l.Fs.Remove(hookPath) } // Check if .old file already exists before renaming. diff --git a/internal/lefthook/run_test.go b/internal/lefthook/run_test.go index 6b5b6fb9..b7cc1a69 100644 --- a/internal/lefthook/run_test.go +++ b/internal/lefthook/run_test.go @@ -12,19 +12,19 @@ import ( type GitMock struct{} -func (g GitMock) Cmd(cmd string) (string, error) { +func (g GitMock) Cmd(_cmd string) (string, error) { return "", nil } -func (g GitMock) CmdArgs(args ...string) (string, error) { +func (g GitMock) CmdArgs(_args ...string) (string, error) { return "", nil } -func (g GitMock) CmdLines(cmd string) ([]string, error) { +func (g GitMock) CmdLines(_cmd string) ([]string, error) { return nil, nil } -func (g GitMock) RawCmd(cmd string) (string, error) { +func (g GitMock) RawCmd(_cmd string) (string, error) { return "", nil } diff --git a/internal/lefthook/runner/runner.go b/internal/lefthook/runner/runner.go index 9342488a..68fb59a8 100644 --- a/internal/lefthook/runner/runner.go +++ b/internal/lefthook/runner/runner.go @@ -314,7 +314,6 @@ func (r *Runner) runCommands() { if len(r.RunOnlyCommands) == 0 || slices.Contains(r.RunOnlyCommands, name) { commands = append(commands, name) } - } sort.Strings(commands) diff --git a/internal/lefthook/runner/runner_test.go b/internal/lefthook/runner/runner_test.go index 61479d84..6a98a055 100644 --- a/internal/lefthook/runner/runner_test.go +++ b/internal/lefthook/runner/runner_test.go @@ -18,7 +18,7 @@ import ( type TestExecutor struct{} -func (e TestExecutor) Execute(opts ExecuteOptions, out io.Writer) (err error) { +func (e TestExecutor) Execute(opts ExecuteOptions, _out io.Writer) (err error) { if opts.args[0] == "success" { err = nil } else { @@ -28,7 +28,7 @@ func (e TestExecutor) Execute(opts ExecuteOptions, out io.Writer) (err error) { return } -func (e TestExecutor) RawExecute(command []string, out io.Writer) error { +func (e TestExecutor) RawExecute(_command []string, _out io.Writer) error { return nil } diff --git a/internal/lefthook/uninstall.go b/internal/lefthook/uninstall.go index bc5b58c7..9074e109 100644 --- a/internal/lefthook/uninstall.go +++ b/internal/lefthook/uninstall.go @@ -47,11 +47,7 @@ func (l *Lefthook) Uninstall(args *UninstallArgs) error { } } - if err := l.Fs.RemoveAll(l.repo.RemotesFolder()); err != nil { - return err - } - - return nil + return l.Fs.RemoveAll(l.repo.RemotesFolder()) } func (l *Lefthook) deleteHooks(force bool) error {