From d86489893d9e1c6304312aaf94c8b854a7e89c43 Mon Sep 17 00:00:00 2001 From: golangci Date: Fri, 25 May 2018 22:30:44 +0300 Subject: [PATCH] move log handling code into root command --- cmd/golangci-lint/main.go | 6 ------ pkg/commands/root.go | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/golangci-lint/main.go b/cmd/golangci-lint/main.go index 6ec42e0c..e67d1e97 100644 --- a/cmd/golangci-lint/main.go +++ b/cmd/golangci-lint/main.go @@ -1,16 +1,10 @@ package main import ( - "log" - "github.com/golangci/golangci-lint/pkg/commands" - "github.com/sirupsen/logrus" ) func main() { - log.SetFlags(0) // don't print time - logrus.SetLevel(logrus.WarnLevel) - e := commands.NewExecutor() if err := e.Execute(); err != nil { panic(err) diff --git a/pkg/commands/root.go b/pkg/commands/root.go index 0a7b900c..3e7620ff 100644 --- a/pkg/commands/root.go +++ b/pkg/commands/root.go @@ -23,8 +23,11 @@ func (e *Executor) initRoot() { PersistentPreRun: func(cmd *cobra.Command, args []string) { runtime.GOMAXPROCS(e.cfg.Run.Concurrency) + log.SetFlags(0) // don't print time if e.cfg.Run.IsVerbose { logrus.SetLevel(logrus.InfoLevel) + } else { + logrus.SetLevel(logrus.WarnLevel) } if e.cfg.Run.CPUProfilePath != "" {