refactor: fix lint issues + gofumpt (#15062)

This commit is contained in:
Facundo Medica
2023-02-19 10:31:49 +00:00
committed by GitHub
parent 2b484a241f
commit 4a6a1e3cb8
234 changed files with 1249 additions and 1077 deletions
+1 -1
View File
@@ -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
}
+5 -5
View File
@@ -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: