-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Sort output of agent-info #572
Conversation
var stats map[string]interface{} | ||
stats, _ = info["stats"] | ||
stats_keys := make([]string, 0, len(stats)) |
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.
You can simplify this as stats_keys := make([]string, len(stats))
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.
Keep in mind that stats_keys is not a idiomatic variable notation in Go. It should be statsKeys (camelcase). My 2 cents.
Thank you for the comments, I've cleaned up variable names. One thing got me curious, changing this:
Made agent-info return a bunch of empy = nil outputs as per this example
Can you explain that? Is it because im re-using variables or what? |
Thx @dadgar ! BTW, judging by hashicorp/consul#969 - I guess both implementations are fine and it's just a matter of style ;-) |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Sorting output of agent-info makes it much more user-friendly.
Note: I'm not a Go developer so feel free to refactor it or leave a comment how to improve it. This is just a proposition.