-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Test commandName subcommand order #12535
base: main
Are you sure you want to change the base?
Conversation
Hi @maxproske |
No worries, let me know if the original sorting is desired, and I'll update the comment/test accordingly. |
cmd/cmdtrace/cmd_span.go
Outdated
@@ -130,7 +129,9 @@ func commandName(cmd *cobra.Command) []string { | |||
} | |||
name = append(name, c.Name()) | |||
} | |||
sort.Sort(sort.Reverse(sort.StringSlice(name))) | |||
for i, j := 0, len(name)-1; i < j; i, j = i+1, j-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.
can use slices.Reverse
- which basically does the same, but will make the intent obvious
I indeed need to check the impact on usage metrics |
Signed-off-by: Max Proske <max@mproske.com>
a61163b
to
c52c3b3
Compare
Reverted to the original sorting, and updated the tests/comment to match intended behaviour. |
What I did
Previously, when the root CLI span
cli/<cmd>
was named, the subcommand path was returned in reverse alphabetical order instead of CLI order, contradicting the comment above the function.edit: Reverted to the original sorting and updated test and function comment to clarify intended behaviour.
Before:
After:
(not mandatory) A picture of a cute animal, if possible in relation to what you did