-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Support struct,array,slice types when sorting kubectl output #25022
Conversation
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
2 similar comments
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test". This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry. Otherwise, if this message is too spammy, please complain to ixdy. |
ae5965f
to
ea3be92
Compare
cc @kubernetes/kubectl |
default: | ||
return false, fmt.Errorf("unsortable type: %v", i.Kind()) | ||
} | ||
} | ||
|
||
// this is a helper func to compare two structs when the given methods exists | ||
func lessFunc(i, j reflect.Value, methods ...string) (supported, less bool) { |
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.
please don't use named returns
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.
document them instead in the comment above
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.
Thanks, will do this.
Add a test for this in hack/test-cmd.sh |
@Kargakis added a test in |
@Kargakis addressing your concern by providing a specific function to compare two |
@@ -153,11 +155,56 @@ func isLess(i, j reflect.Value) (bool, error) { | |||
return i.String() < j.String(), nil | |||
case reflect.Ptr: | |||
return isLess(i.Elem(), j.Elem()) | |||
case reflect.Struct: | |||
// special case handling, unversioned.Time(TODO: add more) |
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.
remove the TODO, since there is notthing to be done. If the need arises, it will happen:)
@zhouhaibing089 thanks! One nit about the todo, this LGTM though |
@Kargakis addressed. thanks for your time. :) |
@bgrant0607 please add a lgtm label here |
@zhouhaibing089 I changed the title to be more understandable in the release notes. Thanks for the review, @Kargakis |
@bgrant0607 Thanks for helping change the title, by the way, could you help to add |
The logs shows:
it looks like kind of flake, though I did not find similar issues via a quick search.. @Kargakis please help to trigger a retest. |
GCE e2e build/test passed for commit 09d4d5e. |
Automatic merge from submit-queue |
Fixes #24328.
Briefly,
sorting_printer
only take cares of the following type kinds:reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64
reflect.Float32, reflect.Float64
reflect.String
reflect.Ptr
This commit aims to add
reflect.Struct, reflect.Slice, reflect.Array
./cc @bgrant0607