cmd/list: Rename a variable for ease of grepping

It's better to avoid single letter variables in general, because they
are so hard to grep for.

This will make the subsequent commit easier to read.

https://github.com/containers/toolbox/pull/1190
This commit is contained in:
Debarshi Ray 2022-12-06 13:22:32 +01:00
parent 2486e25601
commit e1ead145fc

View file

@ -302,7 +302,7 @@ func listOutput(images []toolboxImage, containers []toolboxContainer) {
}
}
func (i *toolboxImage) UnmarshalJSON(data []byte) error {
func (image *toolboxImage) UnmarshalJSON(data []byte) error {
var raw struct {
ID string
Names []string
@ -314,19 +314,19 @@ func (i *toolboxImage) UnmarshalJSON(data []byte) error {
return err
}
i.ID = raw.ID
i.Names = raw.Names
image.ID = raw.ID
image.Names = raw.Names
// Until Podman 2.0.x the field 'Created' held a human-readable string in
// format "5 minutes ago". Since Podman 2.1 the field holds an integer with
// Unix time. Go interprets numbers in JSON as float64.
switch value := raw.Created.(type) {
case string:
i.Created = value
image.Created = value
case float64:
i.Created = utils.HumanDuration(int64(value))
image.Created = utils.HumanDuration(int64(value))
}
i.Labels = raw.Labels
image.Labels = raw.Labels
return nil
}