move log handling code into root command
This commit is contained in:
parent
826ca739a1
commit
d86489893d
@ -1,16 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/golangci/golangci-lint/pkg/commands"
|
"github.com/golangci/golangci-lint/pkg/commands"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(0) // don't print time
|
|
||||||
logrus.SetLevel(logrus.WarnLevel)
|
|
||||||
|
|
||||||
e := commands.NewExecutor()
|
e := commands.NewExecutor()
|
||||||
if err := e.Execute(); err != nil {
|
if err := e.Execute(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -23,8 +23,11 @@ func (e *Executor) initRoot() {
|
|||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
|
runtime.GOMAXPROCS(e.cfg.Run.Concurrency)
|
||||||
|
|
||||||
|
log.SetFlags(0) // don't print time
|
||||||
if e.cfg.Run.IsVerbose {
|
if e.cfg.Run.IsVerbose {
|
||||||
logrus.SetLevel(logrus.InfoLevel)
|
logrus.SetLevel(logrus.InfoLevel)
|
||||||
|
} else {
|
||||||
|
logrus.SetLevel(logrus.WarnLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.cfg.Run.CPUProfilePath != "" {
|
if e.cfg.Run.CPUProfilePath != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user