From f05ab2b1fbd80e284f018ec54712c76c5f67e60a Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Mon, 2 Jul 2018 12:04:09 +0200 Subject: [PATCH] Add omitempty on compose config top-level types Signed-off-by: Vincent Demeester --- cli/command/stack/kubernetes/stackclient_test.go | 4 ---- cli/compose/types/types.go | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cli/command/stack/kubernetes/stackclient_test.go b/cli/command/stack/kubernetes/stackclient_test.go index da4a3426aa..507a589891 100644 --- a/cli/command/stack/kubernetes/stackclient_test.go +++ b/cli/command/stack/kubernetes/stackclient_test.go @@ -32,10 +32,6 @@ services: image: bar foo: image: foo -networks: {} -volumes: {} -secrets: {} -configs: {} `), s.ComposeFile) } diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index 6c1a0dd758..cad26d58b0 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -73,11 +73,11 @@ type Config struct { Filename string `yaml:"-"` Version string Services Services - Networks map[string]NetworkConfig - Volumes map[string]VolumeConfig - Secrets map[string]SecretConfig - Configs map[string]ConfigObjConfig - Extras map[string]interface{} `yaml:",inline"` + Networks map[string]NetworkConfig `yaml:",omitempty"` + Volumes map[string]VolumeConfig `yaml:",omitempty"` + Secrets map[string]SecretConfig `yaml:",omitempty"` + Configs map[string]ConfigObjConfig `yaml:",omitempty"` + Extras map[string]interface{} `yaml:",inline"` } // Services is a list of ServiceConfig