diff options
author | Valery Piashchynski <[email protected]> | 2020-12-23 00:23:55 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-12-23 00:23:55 +0300 |
commit | 83c85ba90d65918e54b81e44bd43f7f5b5e8b557 (patch) | |
tree | 04f370f2c28c6176f8ac3c4775fab9b67b2120ab | |
parent | 1f6749ed4cf3cfd2beade4949945a382abd66b15 (diff) |
Fix golangci liters
-rwxr-xr-x | .golangci.yml | 2 | ||||
-rw-r--r-- | cmd/cli/root.go | 2 | ||||
-rw-r--r-- | cmd/cli/workers.go | 12 | ||||
-rwxr-xr-x | go.mod | 10 | ||||
-rwxr-xr-x | go.sum | 12 |
5 files changed, 27 insertions, 11 deletions
diff --git a/.golangci.yml b/.golangci.yml index 7a49f0c8..208db670 100755 --- a/.golangci.yml +++ b/.golangci.yml @@ -17,7 +17,7 @@ linters: - errcheck - exhaustive # - funlen - - gochecknoinits + # - gochecknoinits # - goconst - gocritic - gocyclo diff --git a/cmd/cli/root.go b/cmd/cli/root.go index b070ca5e..00d192f6 100644 --- a/cmd/cli/root.go +++ b/cmd/cli/root.go @@ -45,7 +45,7 @@ func init() { // todo: properly handle debug level Logger = initLogger() - //endureLogger := logger.NewZapAdapter(Logger) + // endureLogger := logger.NewZapAdapter(Logger) cobra.OnInitialize(func() { if CfgFile != "" { diff --git a/cmd/cli/workers.go b/cmd/cli/workers.go index e031ac6c..e9c8ab2c 100644 --- a/cmd/cli/workers.go +++ b/cmd/cli/workers.go @@ -9,7 +9,9 @@ import ( "time" tm "github.com/buger/goterm" + "github.com/spiral/errors" "github.com/spiral/roadrunner/v2/tools" + "go.uber.org/zap" "github.com/fatih/color" "github.com/spf13/cobra" @@ -43,6 +45,7 @@ func init() { } func workersHandler(cmd *cobra.Command, args []string) error { + const op = errors.Op("workers handler") client, err := RPCClient() if err != nil { return err @@ -50,7 +53,7 @@ func workersHandler(cmd *cobra.Command, args []string) error { defer func() { err := client.Close() if err != nil { - Logger.Error(err.Error()) + Logger.Error("error when closing RPCClient", zap.Error(err)) } }() @@ -75,7 +78,10 @@ func workersHandler(cmd *cobra.Command, args []string) error { return nil case <-time.NewTicker(time.Second).C: tm.MoveCursor(1, 1) - showWorkers(plugins, client) + err := showWorkers(plugins, client) + if err != nil { + return errors.E(op, err) + } tm.Flush() } } @@ -97,12 +103,10 @@ func showWorkers(plugins []string, client *rpc.Client) error { ps[i].MemoryUsage = list.Workers[i].MemoryUsage ps[i].Pid = list.Workers[i].Pid ps[i].Status = list.Workers[i].Status - } fmt.Printf("Workers of [%s]:\n", color.HiYellowString(plugin)) tools.WorkerTable(os.Stdout, ps).Render() } - return nil } @@ -15,15 +15,15 @@ require ( github.com/spiral/errors v1.0.6 github.com/spiral/goridge/v3 v3.0.0-beta8 github.com/spiral/roadrunner-plugins/config v1.0.0 - github.com/spiral/roadrunner-plugins/http v1.0.0 - github.com/spiral/roadrunner-plugins/informer v1.0.3 + github.com/spiral/roadrunner-plugins/http v1.0.1 + github.com/spiral/roadrunner-plugins/informer v1.0.4 github.com/spiral/roadrunner-plugins/logger v1.0.1 github.com/spiral/roadrunner-plugins/metrics v1.0.0 github.com/spiral/roadrunner-plugins/redis v1.0.0 - github.com/spiral/roadrunner-plugins/reload v1.0.0 + github.com/spiral/roadrunner-plugins/reload v1.0.1 github.com/spiral/roadrunner-plugins/resetter v1.0.0 - github.com/spiral/roadrunner-plugins/rpc v1.0.0 - github.com/spiral/roadrunner-plugins/server v1.0.1 + github.com/spiral/roadrunner-plugins/rpc v1.0.1 + github.com/spiral/roadrunner-plugins/server v1.0.3 github.com/stretchr/testify v1.6.1 github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a github.com/vbauerster/mpb/v5 v5.4.0 @@ -421,8 +421,12 @@ github.com/spiral/roadrunner-plugins/config v1.0.0 h1:RPYB8Ha/UeuBGRwtcqNb0uU8R5 github.com/spiral/roadrunner-plugins/config v1.0.0/go.mod h1:XcVJLFDUlYPvZ3kVzssmP4fJbEzUvVJf534+eZaotAo= github.com/spiral/roadrunner-plugins/http v1.0.0 h1:8WGAuZOrkYZQWo6n13ip+ZtzhKugZZ+b5W+ivVr7FjI= github.com/spiral/roadrunner-plugins/http v1.0.0/go.mod h1:37ReUuAKJDtXH3GjMjRH5q3plBXq5r5lUfltRTVZzDE= +github.com/spiral/roadrunner-plugins/http v1.0.1 h1:5pK7390tTcW+LZXCiyH7KowZvcj4Gum/hfAGl8BALDY= +github.com/spiral/roadrunner-plugins/http v1.0.1/go.mod h1:JRgVSgJRh6wDmVs1rFJHQ9PM0xtCpzX9vBtVDItXZ/E= github.com/spiral/roadrunner-plugins/informer v1.0.3 h1:6DXs8IRDjBvAr2mGKXVlhx1KLLfVqpXgvP2va79kR1s= github.com/spiral/roadrunner-plugins/informer v1.0.3/go.mod h1:OPEJNADBbNQyx0/KuXQbY3Mqemo30vZh6duf6YpRf7M= +github.com/spiral/roadrunner-plugins/informer v1.0.4 h1:J2DXrQkRRyYDGw/6TIo7qF74Zn3AOHQe+9g0Hj5BwR4= +github.com/spiral/roadrunner-plugins/informer v1.0.4/go.mod h1:4qvFbVw0ESwE5RJQRiP939QN3SJ8l6aDnrQhL09f5lQ= github.com/spiral/roadrunner-plugins/logger v1.0.1 h1:cc/pRE+8bUQgLiF05G7f948UpWtrZmJk/axTh1ywrks= github.com/spiral/roadrunner-plugins/logger v1.0.1/go.mod h1:/oX1P56+/joLaAPwZaiRqPVVzM36701kdYqOHu+U3EM= github.com/spiral/roadrunner-plugins/metrics v1.0.0 h1:PEK+AlcMv6yrH/vag7yQm/5sV7gMoWsNn9KWOsDPw/0= @@ -431,12 +435,20 @@ github.com/spiral/roadrunner-plugins/redis v1.0.0 h1:/J4JpbNLd0G23BD9VaHsXKR8OHy github.com/spiral/roadrunner-plugins/redis v1.0.0/go.mod h1:VzXRQcNaNONaUxyCW9t9eC+p8UxkXx2kwGeVw3s7zR0= github.com/spiral/roadrunner-plugins/reload v1.0.0 h1:cBevNueyJjG4ykTjd9C4WSV8xNJq3UuXh3ympp3GU0I= github.com/spiral/roadrunner-plugins/reload v1.0.0/go.mod h1:IEDqSrV0zbnvCNXigLtp0EoGVsHc34merlU2gokiuDs= +github.com/spiral/roadrunner-plugins/reload v1.0.1 h1:K7uvITE2B9bZyYWXk2b82erCeWjFBdjcCdfcXDVBjlU= +github.com/spiral/roadrunner-plugins/reload v1.0.1/go.mod h1:IEDqSrV0zbnvCNXigLtp0EoGVsHc34merlU2gokiuDs= github.com/spiral/roadrunner-plugins/resetter v1.0.0 h1:Nx4mIzeoH/IcUfY4LM9xhY0yAXXYkAIAqWCRdMcsr68= github.com/spiral/roadrunner-plugins/resetter v1.0.0/go.mod h1:DLFifJk1n3PWViXkT5+qAmzeRcPTowDRSbRqotf+WlE= github.com/spiral/roadrunner-plugins/rpc v1.0.0 h1:cC17yCNqQUNtedKefdeT2P6z7q52L0QakxS4qwB7n+g= github.com/spiral/roadrunner-plugins/rpc v1.0.0/go.mod h1:p+ClRf1ibW+xvekf+nGQtvipyrtPJP6WZ/J/DSp+Qck= +github.com/spiral/roadrunner-plugins/rpc v1.0.1 h1:rbMJNM+4opzoB7ZXi9dbntfix9+cTuQdUMcDIWsaC7k= +github.com/spiral/roadrunner-plugins/rpc v1.0.1/go.mod h1:iz1a3poEKCppX1fYfneMWOxWBfToYSi2TE1rYD0yBls= +github.com/spiral/roadrunner-plugins/server v1.0.1 h1:yzCw5rgz+KHpJb56QIID3gWH/IBbNtHZD2zvkck1bYc= github.com/spiral/roadrunner-plugins/server v1.0.1/go.mod h1:qedfnQFlK1+Jwv5M8mRXJCOWTvF/qfFyULK/0UMBeOk= +github.com/spiral/roadrunner-plugins/server v1.0.3 h1:Bhr5tK0eW+52/qeew6QMowowOpeUKJv/qqECCmW1X+Y= +github.com/spiral/roadrunner-plugins/server v1.0.3/go.mod h1:XHfOZwvITuKyUwU79KaeMm8gU5AqzKQg0MCHJ7eBU5c= github.com/spiral/roadrunner/v2 v2.0.0-alpha26/go.mod h1:r7ojuHm9qCVbg4fKcqr4Aqk7VXqZ9YPefr1LOv7HNys= +github.com/spiral/roadrunner/v2 v2.0.0-alpha28/go.mod h1:Uqtk/47S+qweVjSl4R9XVImEVZc3nMWku4yg3A+f18Q= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= |