From b7465735d5b8cbe48b7e670e71b87fe7bf651898 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Fri, 5 Aug 2022 12:40:29 +0200 Subject: [PATCH] fix: exit early on run --version --- pkg/commands/root.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/commands/root.go b/pkg/commands/root.go index 8ab119608dc7..7d6af460dec9 100644 --- a/pkg/commands/root.go +++ b/pkg/commands/root.go @@ -8,6 +8,7 @@ import ( "runtime/trace" "strconv" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -18,7 +19,7 @@ import ( func (e *Executor) persistentPreRun(_ *cobra.Command, _ []string) error { if e.cfg.Run.PrintVersion { _, _ = fmt.Fprintf(logutils.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date) - return nil + os.Exit(exitcodes.Success) } runtime.GOMAXPROCS(e.cfg.Run.Concurrency)