-
Notifications
You must be signed in to change notification settings - Fork 362
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
iamrole, internetgateway: use awsclient err wrapper #571
Conversation
Using semgrep I found som additional places where awsclient.Wrap was not used on an error from the AWS API. docker run --rm -v "${PWD}:/src" returntocorp/semgrep --force-color -f ./err.yaml --lang=go ./pkg/controller/ err.yaml: rules: - id: unclean-aws-err patterns: - pattern-either: - patterns: - pattern: | return managed.ExternalCreation{}, errors.Wrap(err, ...); - pattern-inside: |- func ($T $TYPE) Create(...) { ... } patterns: - pattern: | return managed.ExternalUpdate{}, errors.Wrap(err, ...); - pattern-inside: |- func ($T $TYPE) Update(...) { ... } patterns: - pattern: | return errors.Wrap(...); - pattern-inside: |- func ($T $TYPE) Delete(...) { ... } - pattern-not-inside: | if err := $X.preCreate(...); err != nil { ... } - pattern-not-inside: | if err := $X.preUpdate(...); err != nil { ... } - pattern-not-inside: | if err := $X.preDelete(...); err != nil { ... } - pattern-not-inside: | if err := e.kube.Status().Update(ctx, ...); err != nil { ... } - pattern-not-inside: | if err := e.kube.Update(ctx, ...); err != nil { ... } - pattern-not: | err = retry.OnError(..., func() error { ... }) if err != nil { return ..., errors.Wrap(...) } - pattern-not: | return errors.Wrap(..., "pre-delete failed") - pattern-not: | return ..., errors.Wrap(err, errPatchCreationFailed) - pattern-not: | return ..., errors.Wrap(err, errCreatePatch) message: "errors.Wrap should be awsclient.Wrap with error from AWS API" languages: [go] severity: ERROR Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
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.
@muvaf this looks like one we should get in 👍
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.
Thanks @chlunde !
It was in draft but I wanted to merge it before the release since it looks like a fairly contained and known change. |
iamrole, internetgateway: use awsclient err wrapper
Using semgrep I found som additional places where awsclient.Wrap was not
used on an error from the AWS API.
err.yaml:
Signed-off-by: Carl Henrik Lunde chlunde@ifi.uio.no
Description of your changes
Fixes #
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested