refactor: fix lint issues + gofumpt (#15062)
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ information by using Wrap function, for example:
|
||||
|
||||
func safeDiv(val, div int) (int, err) {
|
||||
if div == 0 {
|
||||
return 0, errors.Wrapf(ErrZeroDivision, "cannot divide %d", val)
|
||||
return 0, errorsmod.Wrapf(ErrZeroDivision, "cannot divide %d", val)
|
||||
}
|
||||
return val / div, nil
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ func (s *errorsTestSuite) TestErrorIs() {
|
||||
},
|
||||
"successful comparison to a wrapped error": {
|
||||
a: ErrUnauthorized,
|
||||
b: errors.Wrap(ErrUnauthorized, "gone"),
|
||||
b: errorsmod.Wrap(ErrUnauthorized, "gone"),
|
||||
wantIs: true,
|
||||
},
|
||||
"unsuccessful comparison to a wrapped error": {
|
||||
a: ErrUnauthorized,
|
||||
b: errors.Wrap(ErrInsufficientFee, "too big"),
|
||||
b: errorsmod.Wrap(ErrInsufficientFee, "too big"),
|
||||
wantIs: false,
|
||||
},
|
||||
"not equal to stdlib error": {
|
||||
@@ -82,7 +82,7 @@ func (s *errorsTestSuite) TestErrorIs() {
|
||||
},
|
||||
"not equal to a wrapped stdlib error": {
|
||||
a: ErrUnauthorized,
|
||||
b: errors.Wrap(fmt.Errorf("stdlib error"), "wrapped"),
|
||||
b: errorsmod.Wrap(fmt.Errorf("stdlib error"), "wrapped"),
|
||||
wantIs: false,
|
||||
},
|
||||
"nil is nil": {
|
||||
@@ -226,7 +226,7 @@ func (s *errorsTestSuite) TestGRPCStatus() {
|
||||
|
||||
func ExampleWrap() {
|
||||
err1 := Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
err2 := errors.Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
err2 := errorsmod.Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
fmt.Println(err1.Error())
|
||||
fmt.Println(err2.Error())
|
||||
// Output:
|
||||
@@ -236,7 +236,7 @@ func ExampleWrap() {
|
||||
|
||||
func ExampleWrapf() {
|
||||
err1 := Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
err2 := errors.Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
err2 := errorsmod.Wrap(ErrInsufficientFunds, "90 is smaller than 100")
|
||||
fmt.Println(err1.Error())
|
||||
fmt.Println(err2.Error())
|
||||
// Output:
|
||||
|
||||
Reference in New Issue
Block a user