Small optimization - only store exit code when nonzero

JSON optimizes it out in that case anyways, so don't waste cycles
doing an Itoa (and Atoi on the decode side).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-08-12 16:34:49 -04:00
parent d3a433181d
commit 62e8c328d8

View File

@ -43,7 +43,9 @@ func (e EventJournalD) Write(ee Event) error {
m["PODMAN_IMAGE"] = ee.Image
m["PODMAN_NAME"] = ee.Name
m["PODMAN_ID"] = ee.ID
m["PODMAN_EXIT_CODE"] = strconv.Itoa(ee.ContainerExitCode)
if ee.ContainerExitCode != 0 {
m["PODMAN_EXIT_CODE"] = strconv.Itoa(ee.ContainerExitCode)
}
case Volume:
m["PODMAN_NAME"] = ee.Name
}