Skip to content

Commit

Permalink
sort when getting versions of a single cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispruitt committed Jan 24, 2019
1 parent a1e63a6 commit 9315d16
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func main() {
flag.Parse()

if *versionPtr {
fmt.Println("v1.2.0")
fmt.Println("v1.3.0")
os.Exit(0)
}

Expand Down Expand Up @@ -76,8 +76,11 @@ func printDiff(x map[string]string, y map[string]string) {
}

func printMap(m map[string]string) {
for key, value := range m {
fmt.Println("\t"+key+":", value)

keys := getSortedMapKeys(m)

for _, key := range keys {
fmt.Println("\t"+key+":", m[key])
}
}

Expand Down Expand Up @@ -156,3 +159,13 @@ func removeDuplicates(stringSlice []string) []string {
}
return list
}

func getSortedMapKeys(m map[string]string) []string {
var keys []string
for k := range m {
keys = append(keys, k)
}

sort.Strings(keys)
return keys
}

0 comments on commit 9315d16

Please sign in to comment.