refactor: replace deprecated github.com/pkg/errors with errors pkg (#5577)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user