-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace pkg/errors wrapping with fmt.Errorf #2070
Conversation
cmd/agent/app/builder_test.go
Outdated
@@ -182,7 +181,7 @@ func (fakeCollectorProxy) EmitBatch(batch *jaeger.Batch) (err error) { | |||
} | |||
|
|||
func (f fakeCollectorProxy) GetSamplingStrategy(serviceName string) (*sampling.SamplingStrategyResponse, error) { | |||
return nil, errors.New("no peers available") | |||
return nil, fmt.Errorf("no peers available") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no need to change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many unnecessary changes here. The intention was to remove the use of "github.com/pkg/errors"
, but there's nothing wrong with using the standard errors.New()
.
To ensure that "github.com/pkg/errors"
is gone, we should remove it from Gopkg.toml
Codecov Report
@@ Coverage Diff @@
## master #2070 +/- ##
=======================================
Coverage 96.38% 96.38%
=======================================
Files 214 214
Lines 10525 10529 +4
=======================================
+ Hits 10144 10148 +4
Misses 325 325
Partials 56 56
Continue to review full report at Codecov.
|
copied |
@yurishkuro
|
it's ok to change capitalization. but first please see my comment https://github.com/jaegertracing/jaeger/pull/2070/files#r378924852 - you're making too many unnecessary changes by replacing "errors" with "fmt", which is not in scope of this ticket. |
86c43b7
to
6211b43
Compare
Gopkg.toml
Outdated
[[constraint]] | ||
name = "github.com/pkg/errors" | ||
version = "^0.8.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure to run dep ensure --update
to reflect this change in the lock file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, almost there!
cmd/query/app/http_handler.go
Outdated
if err != nil { | ||
err = fmt.Errorf("unable to parse %s: %w", endTimeParam, err) | ||
} | ||
if aH.handleError(w, err, http.StatusBadRequest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleError
already checks for the error, so these two ifs are redundant. The simplest fix is
if err != nil {
aH.handleError(w, fmt.Errorf("unable to parse %s: %w", endTimeParam, err), http.StatusBadRequest)
return
}
@@ -87,14 +87,14 @@ func (s *ServiceOperationStorage) getServices(context context.Context, indices [ | |||
|
|||
searchResult, err := searchService.Do(context) | |||
if err != nil { | |||
return nil, errors.Wrap(err, "Search service failed") | |||
return nil, fmt.Errorf("search service failed: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: search for services failed
@@ -118,14 +118,14 @@ func (s *ServiceOperationStorage) getOperations(context context.Context, indices | |||
|
|||
searchResult, err := searchService.Do(context) | |||
if err != nil { | |||
return nil, errors.Wrap(err, "Search service failed") | |||
return nil, fmt.Errorf("search service failed: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: search for operations failed
d2c9e42
to
9d05996
Compare
The linter is breaking due to upgrade of grpc. I am adjusting the deps separately in #2072. |
NB: you may want to undo the |
Signed-off-by: u5surf <u5.horie@gmail.com>
@yurishkuro Certainly, Gopkg.* reverted. |
Thank you! |
Which problem is this PR solving?
Short description of the changes
fmt.Errorf