refactor: replace deprecated github.com/pkg/errors with errors pkg (#5577)

This commit is contained in:
Oleksandr Redko
2024-02-02 16:56:28 +02:00
committed by GitHub
parent 2dafe7709a
commit 426aad68dc
14 changed files with 34 additions and 55 deletions

View File

@@ -7,7 +7,6 @@ import (
"sync"
"github.com/gogo/protobuf/proto"
"github.com/pkg/errors"
"github.com/beego/beego/v2/core/logs"
)
@@ -110,7 +109,7 @@ func (c *aliLSWriter) Init(config string) error {
if len(c.Formatter) > 0 {
fmtr, ok := logs.GetFormatter(c.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", c.Formatter))
return fmt.Errorf("the formatter with name: %s not found", c.Formatter)
}
c.formatter = fmtr
}

View File

@@ -19,8 +19,6 @@ import (
"fmt"
"io"
"net"
"github.com/pkg/errors"
)
// connWriter implements LoggerInterface.
@@ -56,7 +54,7 @@ func (c *connWriter) Init(config string) error {
if res == nil && len(c.Formatter) > 0 {
fmtr, ok := GetFormatter(c.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", c.Formatter))
return fmt.Errorf("the formatter with name: %s not found", c.Formatter)
}
c.formatter = fmtr
}

View File

@@ -20,7 +20,6 @@ import (
"os"
"strings"
"github.com/pkg/errors"
"github.com/shiena/ansicolor"
)
@@ -95,7 +94,7 @@ func (c *consoleWriter) Init(config string) error {
if res == nil && len(c.Formatter) > 0 {
fmtr, ok := GetFormatter(c.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", c.Formatter))
return fmt.Errorf("the formatter with name: %s not found", c.Formatter)
}
c.formatter = fmtr
}

View File

@@ -5,8 +5,6 @@ import (
"fmt"
"net/http"
"net/url"
"github.com/pkg/errors"
)
// JLWriter implements beego LoggerInterface and is used to send jiaoliao webhook
@@ -35,7 +33,7 @@ func (s *JLWriter) Init(config string) error {
if res == nil && len(s.Formatter) > 0 {
fmtr, ok := GetFormatter(s.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", s.Formatter))
return fmt.Errorf("the formatter with name: %s not found", s.Formatter)
}
s.formatter = fmtr
}

View File

@@ -5,8 +5,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"github.com/pkg/errors"
)
// SLACKWriter implements beego LoggerInterface and is used to send jiaoliao webhook
@@ -40,7 +38,7 @@ func (s *SLACKWriter) Init(config string) error {
if res == nil && len(s.Formatter) > 0 {
fmtr, ok := GetFormatter(s.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", s.Formatter))
return fmt.Errorf("the formatter with name: %s not found", s.Formatter)
}
s.formatter = fmtr
}

View File

@@ -21,8 +21,6 @@ import (
"net"
"net/smtp"
"strings"
"github.com/pkg/errors"
)
// SMTPWriter implements LoggerInterface and is used to send emails via given SMTP-server.
@@ -62,7 +60,7 @@ func (s *SMTPWriter) Init(config string) error {
if res == nil && len(s.Formatter) > 0 {
fmtr, ok := GetFormatter(s.Formatter)
if !ok {
return errors.New(fmt.Sprintf("the formatter with name: %s not found", s.Formatter))
return fmt.Errorf("the formatter with name: %s not found", s.Formatter)
}
s.formatter = fmtr
}