Bug fixes: Null pointer safety, ignored errors, map initialization, logger typo #186
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While analyzing the CNPG-I Hello World plugin codebase, I identified multiple potential runtime issues and areas for improvement that do not affect the functional behavior of the plugin but improve code safety and readability.
This PR addresses:
Bug Fixes:
lifecycle.go:operationTypeandGetType()to avoid panics during lifecycle hooks.validation.go:config.FromParametersfor old cluster configuration.lifecycle.go:LabelsandAnnotationsmaps are initialized before assignment to avoid nil map assignment panics.cnpg_i_example_lifecyle→cnpg_i_example_lifecyclein multiple files.Code Quality Improvements:
status.gofor easier debugging when plugin status entries are missing.SetStatusInClusterto avoid potential hanging goroutines.config.goto guard against nil plugin helpers.Impact
Related Issues
N/A (Discovered during analysis of issue #129 but independent of it)
Checklist
Thanks for your time! Let me know if you'd like me to further split these fixes into smaller PRs.