Skip to content

Commit

Permalink
Avoid empty fields in crictl inspect(p/i) result.
Browse files Browse the repository at this point in the history
Signed-off-by: Lantao Liu <lantaol@google.com>
  • Loading branch information
Random-Liu committed Sep 19, 2019
1 parent f11768f commit aec0fd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/crictl/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func outputProtobufObjAsYAML(obj proto.Message) error {

func outputStatusInfo(status string, info map[string]string, format string) error {
// Sort all keys
keys := make([]string, len(info))
keys := []string{}
for k := range info {
keys = append(keys, k)
}
Expand Down Expand Up @@ -267,7 +267,7 @@ func marshalMapInOrder(m map[string]interface{}, t interface{}) (string, error)
v := reflect.ValueOf(t)
for i := 0; i < v.Type().NumField(); i++ {
field := jsonFieldFromTag(v.Type().Field(i).Tag)
if field == "" {
if field == "" || field == "-" {
continue
}
value, err := json.Marshal(m[field])
Expand Down

0 comments on commit aec0fd8

Please sign in to comment.