-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🌱 Bumping tablewriter to v1.0.9 - latest #12781
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR is currently missing an area label, which is used to identify the modified component when generating release notes. Area labels can be added by org members by writing Please see the labels list for possible areas. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @irapandey. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
These need not to be set separately as they are set by default as |
d6abc40
to
54cab07
Compare
ira@Iras-MacBook-Pro cluster-api % go test -v ./internal/util/tree
=== RUN Test_getRowName
=== RUN Test_getRowName/Row_name_for_objects_should_be_kind/name
=== RUN Test_getRowName/Row_name_for_a_deleting_object_should_have_deleted_prefix
=== RUN Test_getRowName/Row_name_for_objects_with_meta_name_should_be_meta-name_-_kind/name
=== RUN Test_getRowName/Row_name_for_virtual_objects_should_be_name
=== RUN Test_getRowName/Row_name_for_group_objects_should_be_#-of-items_kind
--- PASS: Test_getRowName (0.00s)
--- PASS: Test_getRowName/Row_name_for_objects_should_be_kind/name (0.00s)
--- PASS: Test_getRowName/Row_name_for_a_deleting_object_should_have_deleted_prefix (0.00s)
--- PASS: Test_getRowName/Row_name_for_objects_with_meta_name_should_be_meta-name_-_kind/name (0.00s)
--- PASS: Test_getRowName/Row_name_for_virtual_objects_should_be_name (0.00s)
--- PASS: Test_getRowName/Row_name_for_group_objects_should_be_#-of-items_kind (0.00s)
=== RUN Test_newConditionDescriptor_readyColor
=== RUN Test_newConditionDescriptor_readyColor/True_condition_should_be_green
=== RUN Test_newConditionDescriptor_readyColor/Unknown_condition_should_be_white
=== RUN Test_newConditionDescriptor_readyColor/False_condition,_severity_error_should_be_red
=== RUN Test_newConditionDescriptor_readyColor/False_condition,_severity_warning_should_be_yellow
=== RUN Test_newConditionDescriptor_readyColor/False_condition,_severity_info_should_be_white
=== RUN Test_newConditionDescriptor_readyColor/Condition_without_status_should_be_gray
--- PASS: Test_newConditionDescriptor_readyColor (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/True_condition_should_be_green (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/Unknown_condition_should_be_white (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/False_condition,_severity_error_should_be_red (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/False_condition,_severity_warning_should_be_yellow (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/False_condition,_severity_info_should_be_white (0.00s)
--- PASS: Test_newConditionDescriptor_readyColor/Condition_without_status_should_be_gray (0.00s)
=== RUN Test_newConditionDescriptor_truncateMessages
=== RUN Test_newConditionDescriptor_truncateMessages/Short_messages_are_not_changed
=== RUN Test_newConditionDescriptor_truncateMessages/Long_message_are_truncated
--- PASS: Test_newConditionDescriptor_truncateMessages (0.00s)
--- PASS: Test_newConditionDescriptor_truncateMessages/Short_messages_are_not_changed (0.00s)
--- PASS: Test_newConditionDescriptor_truncateMessages/Long_message_are_truncated (0.00s)
=== RUN Test_V1Beta1TreePrefix
=== RUN Test_V1Beta1TreePrefix/First_level_child_should_get_the_right_prefix
=== RUN Test_V1Beta1TreePrefix/Second_level_child_should_get_the_right_prefix
=== RUN Test_V1Beta1TreePrefix/Conditions_should_get_the_right_prefix
=== RUN Test_V1Beta1TreePrefix/Conditions_should_get_the_right_prefix_if_the_object_has_a_child
--- PASS: Test_V1Beta1TreePrefix (0.00s)
--- PASS: Test_V1Beta1TreePrefix/First_level_child_should_get_the_right_prefix (0.00s)
--- PASS: Test_V1Beta1TreePrefix/Second_level_child_should_get_the_right_prefix (0.00s)
--- PASS: Test_V1Beta1TreePrefix/Conditions_should_get_the_right_prefix (0.00s)
--- PASS: Test_V1Beta1TreePrefix/Conditions_should_get_the_right_prefix_if_the_object_has_a_child (0.00s)
=== RUN Test_TreePrefix
=== RUN Test_TreePrefix/Conditions_should_get_the_right_prefix_with_multiline_message
=== RUN Test_TreePrefix/Conditions_should_get_the_right_prefix_with_multiline_message_and_a_child
=== RUN Test_TreePrefix/Multiple_nested_childs_should_get_the_right_multiline_prefix
=== RUN Test_TreePrefix/Nested_childs_should_get_the_right_prefix_with_multiline_message
=== RUN Test_TreePrefix/Conditions_should_get_the_right_prefix_with_childs
--- PASS: Test_TreePrefix (0.00s)
--- PASS: Test_TreePrefix/Conditions_should_get_the_right_prefix_with_multiline_message (0.00s)
--- PASS: Test_TreePrefix/Conditions_should_get_the_right_prefix_with_multiline_message_and_a_child (0.00s)
--- PASS: Test_TreePrefix/Multiple_nested_childs_should_get_the_right_multiline_prefix (0.00s)
--- PASS: Test_TreePrefix/Nested_childs_should_get_the_right_prefix_with_multiline_message (0.00s)
--- PASS: Test_TreePrefix/Conditions_should_get_the_right_prefix_with_childs (0.00s)
=== RUN Test_formatParagraph
=== RUN Test_formatParagraph/0
=== RUN Test_formatParagraph/1
=== RUN Test_formatParagraph/2
--- PASS: Test_formatParagraph (0.00s)
--- PASS: Test_formatParagraph/0 (0.00s)
--- PASS: Test_formatParagraph/1 (0.00s)
--- PASS: Test_formatParagraph/2 (0.00s)
PASS
ok sigs.k8s.io/cluster-api/internal/util/tree 0.443s
ira@Iras-MacBook-Pro cluster-api % |
The changes in go.sum and go.mod apart from the tablewriter originated from |
Used this guide to migrate from |
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.
best to show the before and after output in text / screenehots.
/ok-to-test |
Hey @neolit123 I did tilt-up with main branch and my feature branch The expected result for unit tests are unchanged and tests are passing successfully |
WIP - linting with error message |
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.
added some comments. thanks for the updates.
please keep the commits squashed to 1.
// Prints the output table | ||
tbl.Render() | ||
if err := tbl.Render(); err != nil { | ||
fmt.Printf("Error rendering table: %v", err) |
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.
fprint to w. same for other cases below.
return tbl | ||
} | ||
|
||
// CreateObjectTreeV1Beta1 creates a new tablewriter.Table for the object tree. |
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.
can there be a single function?
if not best to clarify this in the comment.
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.
I suppose they can be clubbed in - there is a difference for an extra space
But they are different versions and clubbing together doesn't seem to be a great idea IMO
Thoughts? @sbueringer
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.
tbl.Render() | ||
if err := tbl.Render(); err != nil { | ||
fmt.Printf("Error rendering table: %v", err) | ||
os.Exit(1) |
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.
exiting from printing functions does not seem right. better to return errors.
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.
sure - I'll exit the function with return err message
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.
Hey @neolit123 - I was working on returning the err instead of os.Exit - I found that returning error from these functions would impact whole lot of code in terms of error handling
Will have to catch the error as well - I suppose printing the error message should suffice - I am still confused though
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.
I think last time @sivchari also mentioned to handle the error #12320 (comment),
I think may be you can handle error and and keep those changes in seperate commit, based on the further review we can decide later?
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.
how did it work before this PR?
i did not see any exit calls in the old code or maybe i missed them.
it's an indication that the application is not organized well.
errors should propagate up to callers and ideally there shouldn't be any os.Exit calls in the code base other than the main.go. i suggest you do the necessary refactor in this PR in separate commits as @Karthik-K-N suggested ^
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.
how did it work before this PR?
i did not see any exit calls in the old code or maybe i missed them.
I think in the previous version of tablewriter t.Render() never used to return error, Its new in this update.
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.
Yup - the functions append() and render() have now started to return errors - it's one of the major changes in the v1.0.0+ release pf tablewriter package
I'll do the error handling in a separate commit as suggested
Thanks 😄
Usually we don't enforce this in CAPI and just use the squash merge method with tide. Is there a problem with that? |
nukes gpg signatures, but most commiters don't use them and therefore they will not require you later to revert their unsigned commits. |
dd9cf0e
to
a478afc
Compare
a478afc
to
6262377
Compare
6262377
to
c0a7775
Compare
What this PR does / why we need it:
This PR bumps up the github.com/olekukonko/tablewriter to latest (v1.0.9)
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #12318
/area misc