[#973] node: Resolve perfsprint linter

`fmt.Errorf can be replaced with errors.New` and `fmt.Sprintf can be replaced with string addition`

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-03-11 17:55:50 +03:00
parent 66a26b7775
commit d433b49265
39 changed files with 143 additions and 72 deletions

View file

@ -1,7 +1,6 @@
package main
import (
"fmt"
"net/http"
"time"
@ -26,7 +25,7 @@ const (
)
func (c *httpComponent) init() {
log.Info(fmt.Sprintf("init %s", c.name))
log.Info("init " + c.name)
c.enabled = cfg.GetBool(c.name + enabledKeyPostfix)
c.address = cfg.GetString(c.name + addressKeyPostfix)
c.shutdownDur = cfg.GetDuration(c.name + shutdownTimeoutKeyPostfix)
@ -40,14 +39,14 @@ func (c *httpComponent) init() {
httputil.WithShutdownTimeout(c.shutdownDur),
)
} else {
log.Info(fmt.Sprintf("%s is disabled, skip", c.name))
log.Info(c.name + " is disabled, skip")
c.srv = nil
}
}
func (c *httpComponent) start() {
if c.srv != nil {
log.Info(fmt.Sprintf("start %s", c.name))
log.Info("start " + c.name)
wg.Add(1)
go func() {
defer wg.Done()
@ -58,7 +57,7 @@ func (c *httpComponent) start() {
func (c *httpComponent) shutdown() error {
if c.srv != nil {
log.Info(fmt.Sprintf("shutdown %s", c.name))
log.Info("shutdown " + c.name)
return c.srv.Shutdown()
}
return nil
@ -72,9 +71,9 @@ func (c *httpComponent) needReload() bool {
}
func (c *httpComponent) reload() {
log.Info(fmt.Sprintf("reload %s", c.name))
log.Info("reload " + c.name)
if c.needReload() {
log.Info(fmt.Sprintf("%s config updated", c.name))
log.Info(c.name + " config updated")
if err := c.shutdown(); err != nil {
log.Debug(logs.FrostFSIRCouldNotShutdownHTTPServer,
zap.String("error", err.Error()),