Skip to content
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

CNI CMD Add - Avoid relying on err var in cleanup #233

Open
adrianchiris opened this issue Nov 21, 2022 · 0 comments
Open

CNI CMD Add - Avoid relying on err var in cleanup #233

adrianchiris opened this issue Nov 21, 2022 · 0 comments

Comments

@adrianchiris
Copy link
Contributor

Currently if cmdAdd function fails, we rely on top level err error variable to determine if cleanup needs to occur via defer statements [1]
This is brittle as err variable may be re-declared in inner-scope masking it and in case of error in inner scope causing the deferred functions to behave in an un-desirable manner (essentially do nothing)

we should come up with a better mechanism for cleanup. it might not look pretty but it should be more robust.

[1]

defer func() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant