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

return blank cleanup func for plugin.InmemCreationFunc #117

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

bosorawis
Copy link
Contributor

Return a blank cleanup func instead of nil to prevent accidental panic from defer cleanup()

@jefferai
Copy link
Member

jefferai commented Feb 6, 2024

This looks good - wherever you saw the panic can you also add a nil check there? Not sure if it was in this package or elsewhere.

@bosorawis
Copy link
Contributor Author

@jefferai I ran into the panic in HCP Boundary code, not sure it also happens elsewhere. This PR is referenced above

Copy link
Member

@jefferai jefferai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 254 we create a cleanup func that is returned in success scenarios; depending on various conditions we modify that cleanup func later. Rather than create a func inline here, can you move creation of that cleanup above this (but returning nil) and simply reassign it on line 254?

That just keeps the return pattern consistent throughout.

@bosorawis
Copy link
Contributor Author

bosorawis commented Feb 8, 2024

@jefferai done! thank you! 😄

@jefferai jefferai merged commit e24d505 into main Feb 13, 2024
20 checks passed
@jefferai jefferai deleted the bosorawis-inmem-plugin-nil-cleanup branch February 13, 2024 02:17
@jefferai
Copy link
Member

Tagged v2.0.7.

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

Successfully merging this pull request may close these issues.

None yet

3 participants