Skip to content

Commit

Permalink
remove unneccessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
aperezg committed Sep 22, 2019
1 parent e697750 commit 52a8cd3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
14 changes: 1 addition & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ jobs:
- checkout
- run: make coverage
- run: bash <(curl -s https://codecov.io/bash)
release:
docker:
- image: circleci/golang:latest
steps:
- checkout
- run: curl -sL https://git.io/goreleaser | bash
workflows:
version: 2
build_and_test:
Expand All @@ -58,10 +52,4 @@ workflows:
- build-go1_12_9
- build-go1_13
- build-go_latest
- coverage
- release:
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
- coverage
14 changes: 6 additions & 8 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
// considered a part of its stable public interface.
//
// With the new standard package error we have two new ways to figure what is the cause of
// our error.
// our error:
//
// var target *MyError
// if errors.As(err, &target) {
// // handle specifically
// } else {
// // unknown error
// }
// }
//
// or even with sentinel errors:
//
Expand Down Expand Up @@ -211,13 +211,12 @@ func Wrap(err error, message string) error {
if err == nil {
return nil
}
wErr := fmt.Errorf("%w", err)
wErr = &withMessage{
err = &withMessage{
cause: err,
msg: message,
}
return &withStack{
wErr,
err,
callers(),
}
}
Expand All @@ -229,13 +228,12 @@ func Wrapf(err error, format string, args ...interface{}) error {
if err == nil {
return nil
}
wErr := fmt.Errorf("%w", err)
wErr = &withMessage{
err = &withMessage{
cause: err,
msg: fmt.Sprintf(format, args...),
}
return &withStack{
wErr,
err,
callers(),
}
}
Expand Down
3 changes: 1 addition & 2 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,4 @@ func TestAs(t *testing.T) {
if !As(wrap, &tt) {
t.Errorf("Expected that '%v' error and the '%v' error should be of the same type", err, wrap)
}

}
}
10 changes: 4 additions & 6 deletions xerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,12 @@ func Wrap(err error, message string) error {
if err == nil {
return nil
}
wErr := xerrors.Errorf("%w", err)
wErr = &withMessage{
err = &withMessage{
cause: err,
msg: message,
}
return &withStack{
wErr,
err,
callers(),
}
}
Expand All @@ -230,13 +229,12 @@ func Wrapf(err error, format string, args ...interface{}) error {
if err == nil {
return nil
}
wErr := xerrors.Errorf("%w", err)
wErr = &withMessage{
err = &withMessage{
cause: err,
msg: fmt.Sprintf(format, args...),
}
return &withStack{
wErr,
err,
callers(),
}
}
Expand Down

0 comments on commit 52a8cd3

Please sign in to comment.