Bug fixes: Null pointer safety, ignored errors, map initialization, logger typo#186
Open
DevAnuragT wants to merge 2 commits intocloudnative-pg:mainfrom
Open
Bug fixes: Null pointer safety, ignored errors, map initialization, logger typo#186DevAnuragT wants to merge 2 commits intocloudnative-pg:mainfrom
DevAnuragT wants to merge 2 commits intocloudnative-pg:mainfrom
Conversation
Signed-off-by: Anurag Thakur <anuragthakur2102@gmail.com>
…er typo - Added null pointer checks in lifecycle.go to prevent runtime panics. - Handled ignored error return in validation.go (old configuration parsing). - Ensured proper initialization of Labels and Annotations maps in lifecycle.go. - Fixed logger name typo: 'cnpg_i_example_lifecyle' → 'cnpg_i_example_lifecycle'. - Improved error messages in status.go for better debuggability. - Added context timeout handling in status.go. - Minor input validation for config.FromParameters. Signed-off-by: Anurag Thakur <anuragthakur2102@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.