sort all map type result in ocic

Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
Crazykev 2016-11-02 14:36:42 +08:00
parent 018c4db06d
commit 295c32331a
2 changed files with 23 additions and 12 deletions

View file

@ -453,14 +453,14 @@ func ListContainers(client pb.RuntimeServiceClient, opts listOptions) error {
}
if c.Labels != nil {
fmt.Println("Labels:")
for k, v := range c.Labels {
fmt.Printf("\t%s -> %s\n", k, v)
for _, k := range getSortedKeys(c.Labels) {
fmt.Printf("\t%s -> %s\n", k, c.Labels[k])
}
}
if c.Annotations != nil {
fmt.Println("Annotations:")
for k, v := range c.Annotations {
fmt.Printf("\t%s -> %s\n", k, v)
for _, k := range getSortedKeys(c.Annotations) {
fmt.Printf("\t%s -> %s\n", k, c.Annotations[k])
}
}
fmt.Println()