Skip to content

Commit 52a8cd3

Browse files
committed
remove unneccessary code
1 parent e697750 commit 52a8cd3

File tree

4 files changed

+12
-29
lines changed

4 files changed

+12
-29
lines changed

.circleci/config.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ jobs:
4444
- checkout
4545
- run: make coverage
4646
- run: bash <(curl -s https://codecov.io/bash)
47-
release:
48-
docker:
49-
- image: circleci/golang:latest
50-
steps:
51-
- checkout
52-
- run: curl -sL https://git.io/goreleaser | bash
5347
workflows:
5448
version: 2
5549
build_and_test:
@@ -58,10 +52,4 @@ workflows:
5852
- build-go1_12_9
5953
- build-go1_13
6054
- build-go_latest
61-
- coverage
62-
- release:
63-
filters:
64-
branches:
65-
ignore: /.*/
66-
tags:
67-
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
55+
- coverage

errors.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@
6161
// considered a part of its stable public interface.
6262
//
6363
// With the new standard package error we have two new ways to figure what is the cause of
64-
// our error.
64+
// our error:
6565
//
6666
// var target *MyError
6767
// if errors.As(err, &target) {
6868
// // handle specifically
6969
// } else {
7070
// // unknown error
71-
// }
71+
// }
7272
//
7373
// or even with sentinel errors:
7474
//
@@ -211,13 +211,12 @@ func Wrap(err error, message string) error {
211211
if err == nil {
212212
return nil
213213
}
214-
wErr := fmt.Errorf("%w", err)
215-
wErr = &withMessage{
214+
err = &withMessage{
216215
cause: err,
217216
msg: message,
218217
}
219218
return &withStack{
220-
wErr,
219+
err,
221220
callers(),
222221
}
223222
}
@@ -229,13 +228,12 @@ func Wrapf(err error, format string, args ...interface{}) error {
229228
if err == nil {
230229
return nil
231230
}
232-
wErr := fmt.Errorf("%w", err)
233-
wErr = &withMessage{
231+
err = &withMessage{
234232
cause: err,
235233
msg: fmt.Sprintf(format, args...),
236234
}
237235
return &withStack{
238-
wErr,
236+
err,
239237
callers(),
240238
}
241239
}

errors_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,5 +270,4 @@ func TestAs(t *testing.T) {
270270
if !As(wrap, &tt) {
271271
t.Errorf("Expected that '%v' error and the '%v' error should be of the same type", err, wrap)
272272
}
273-
274-
}
273+
}

xerrors.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,12 @@ func Wrap(err error, message string) error {
212212
if err == nil {
213213
return nil
214214
}
215-
wErr := xerrors.Errorf("%w", err)
216-
wErr = &withMessage{
215+
err = &withMessage{
217216
cause: err,
218217
msg: message,
219218
}
220219
return &withStack{
221-
wErr,
220+
err,
222221
callers(),
223222
}
224223
}
@@ -230,13 +229,12 @@ func Wrapf(err error, format string, args ...interface{}) error {
230229
if err == nil {
231230
return nil
232231
}
233-
wErr := xerrors.Errorf("%w", err)
234-
wErr = &withMessage{
232+
err = &withMessage{
235233
cause: err,
236234
msg: fmt.Sprintf(format, args...),
237235
}
238236
return &withStack{
239-
wErr,
237+
err,
240238
callers(),
241239
}
242240
}

0 commit comments

Comments
 (0)