From 80031e4d950f3ffc6bedc81e68d5b9da2e1c92ef Mon Sep 17 00:00:00 2001 From: Byron Wolfman Date: Thu, 19 Sep 2024 16:19:33 -0400 Subject: [PATCH] Resolve Go linter findings --- client/rpc_client.go | 12 ++++++------ cmd/serf/command/info.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/rpc_client.go b/client/rpc_client.go index 99470f240..a1c242ad0 100644 --- a/client/rpc_client.go +++ b/client/rpc_client.go @@ -5,7 +5,7 @@ package client import ( "bufio" - "fmt" + "errors" "log" "net" "sync" @@ -23,7 +23,7 @@ const ( ) var ( - clientClosed = fmt.Errorf("client closed") + clientClosed = errors.New("client closed") ) type seqCallback struct { @@ -453,7 +453,7 @@ func (mh *monitorHandler) Cleanup() { if !mh.closed { if !mh.init { mh.init = true - mh.initCh <- fmt.Errorf("Stream closed") + mh.initCh <- errors.New("Stream closed") } if mh.logCh != nil { close(mh.logCh) @@ -535,7 +535,7 @@ func (sh *streamHandler) Cleanup() { if !sh.closed { if !sh.init { sh.init = true - sh.initCh <- fmt.Errorf("Stream closed") + sh.initCh <- errors.New("Stream closed") } if sh.eventCh != nil { close(sh.eventCh) @@ -636,7 +636,7 @@ func (qh *queryHandler) Cleanup() { if !qh.closed { if !qh.init { qh.init = true - qh.initCh <- fmt.Errorf("Stream closed") + qh.initCh <- errors.New("Stream closed") } if qh.ackCh != nil { close(qh.ackCh) @@ -788,7 +788,7 @@ func (c *RPCClient) genericRPC(header *requestHeader, req interface{}, resp inte // strToError converts a string to an error if not blank func strToError(s string) error { if s != "" { - return fmt.Errorf(s) + return errors.New(s) } return nil } diff --git a/cmd/serf/command/info.go b/cmd/serf/command/info.go index f2bb496b0..bccbb76bc 100644 --- a/cmd/serf/command/info.go +++ b/cmd/serf/command/info.go @@ -91,7 +91,7 @@ func (s StatsContainer) String() string { // Iterate over each top-level key for _, key := range keys { - buf.WriteString(fmt.Sprintf(key + ":\n")) + buf.WriteString(fmt.Sprintf("%s:\n", key)) // Sort the sub-keys subvals := s[key]