Skip to content

Commit

Permalink
fix: exit early on run --version
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Aug 5, 2022
1 parent 0a884a4 commit 57f07b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/commands/root.go
Expand Up @@ -12,13 +12,14 @@ import (
"github.com/spf13/pflag"

"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/logutils"
)

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)
Expand Down

0 comments on commit 57f07b4

Please sign in to comment.