change use of errors.Wrap to fmt.Errorf with %w verb

Closes #4603

Commands used (VIM):

```
:args `rg -l errors.Wrap`
:argdo normal @q | update
```

where q is a macros rewriting the `errors.Wrap` to `fmt.Errorf`.
This commit is contained in:
Anton Kaliaev
2020-05-12 03:35:47 +00:00
committed by GitHub
parent 8d63d7192f
commit b7b721c484
90 changed files with 321 additions and 391 deletions
+2 -3
View File
@@ -1,9 +1,8 @@
package async
import (
"fmt"
"sync/atomic"
"github.com/pkg/errors"
)
//----------------------------------------
@@ -144,7 +143,7 @@ func Parallel(tasks ...Task) (trs *TaskResultSet, ok bool) {
if pnk := recover(); pnk != nil {
atomic.AddInt32(numPanics, 1)
// Send panic to taskResultCh.
taskResultCh <- TaskResult{nil, errors.Errorf("panic in task %v", pnk)}
taskResultCh <- TaskResult{nil, fmt.Errorf("panic in task %v", pnk)}
// Closing taskResultCh lets trs.Wait() work.
close(taskResultCh)
// Decrement waitgroup.
+2 -2
View File
@@ -1,12 +1,12 @@
package async
import (
"errors"
"fmt"
"sync/atomic"
"testing"
"time"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
@@ -125,7 +125,7 @@ func TestParallelRecover(t *testing.T) {
// Verify task #0, #1, #2.
checkResult(t, taskResultSet, 0, 0, nil, nil)
checkResult(t, taskResultSet, 1, 1, errors.New("some error"), nil)
checkResult(t, taskResultSet, 2, nil, nil, errors.Errorf("panic in task %v", 2).Error())
checkResult(t, taskResultSet, 2, nil, nil, fmt.Errorf("panic in task %v", 2).Error())
}
// Wait for result