Browse Source

daemon/config.New(): rewrite to be slightly more idiomatic

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 4 năm trước cách đây
mục cha
commit
0ff80c844d
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      daemon/config/config.go

+ 8 - 4
daemon/config/config.go

@@ -282,10 +282,14 @@ func (conf *Config) IsValueSet(name string) bool {
 
 // New returns a new fully initialized Config struct
 func New() *Config {
-	config := Config{}
-	config.LogConfig.Config = make(map[string]string)
-	config.ClusterOpts = make(map[string]string)
-	return &config
+	return &Config{
+		CommonConfig: CommonConfig{
+			LogConfig: LogConfig{
+				Config: make(map[string]string),
+			},
+			ClusterOpts: make(map[string]string),
+		},
+	}
 }
 
 // ParseClusterAdvertiseSettings parses the specified advertise settings