Move the sort to the constructors.

This commit is contained in:
Gregory Kurtzer
2020-12-22 21:18:15 -08:00
parent a741b7e668
commit 780fb4faa8
3 changed files with 11 additions and 19 deletions

View File

@@ -30,17 +30,6 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
os.Exit(1)
}
sort.Slice(nodes, func(i, j int) bool {
if nodes[i].ClusterName.Get() < nodes[j].ClusterName.Get() {
return true
} else if nodes[i].ClusterName.Get() == nodes[j].ClusterName.Get() {
if nodes[i].Id.Get() < nodes[j].Id.Get() {
return true
}
}
return false
})
if ShowAll == true {
for _, node := range nodes {
fmt.Printf("################################################################################\n")