Format times in inspect command with a template as RFC3339Nano

In 1.6.2 we were decoding inspect API response into interface{}.
time.Time fields were JSON encoded as RFC3339Nano in the response
and when decoded into interface{} they were just strings so the inspect
template treated them as just strings.
From 1.7 we are decoding into types.ContainerJSON and when the template
gets executed it now gets a time.Time and it's formatted as
2015-07-22 05:02:38.091530369 +0000 UTC.
This patch brings back the old behavior by typing time.Time fields
as string so they gets formatted as they were encoded in JSON -- RCF3339Nano

Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
Antonio Murdaca
2015-07-26 15:25:08 +02:00
parent c051ed7953
commit c9207bc0aa
4 changed files with 36 additions and 8 deletions
+4 -4
View File
@@ -86,7 +86,7 @@ type ImageInspect struct {
Id string
Parent string
Comment string
Created time.Time
Created string
Container string
ContainerConfig *runconfig.Config
DockerVersion string
@@ -215,14 +215,14 @@ type ContainerState struct {
Pid int
ExitCode int
Error string
StartedAt time.Time
FinishedAt time.Time
StartedAt string
FinishedAt string
}
// GET "/containers/{name:.*}/json"
type ContainerJSONBase struct {
Id string
Created time.Time
Created string
Path string
Args []string
State *ContainerState