diff --git a/src/autoscaler/metricsforwarder/config/config.go b/src/autoscaler/metricsforwarder/config/config.go index 217d43d42e..e8a964f4f0 100644 --- a/src/autoscaler/metricsforwarder/config/config.go +++ b/src/autoscaler/metricsforwarder/config/config.go @@ -90,6 +90,9 @@ func LoadConfig(reader io.Reader) (*Config, error) { dec := yaml.NewDecoder(reader) dec.KnownFields(true) err := dec.Decode(conf) + if err != nil { + return nil, err + } if os.Getenv("PORT") != "" { port := os.Getenv("PORT") @@ -100,10 +103,6 @@ func LoadConfig(reader io.Reader) (*Config, error) { conf.Server.Port = portNumber } - if err != nil { - return nil, err - } - return conf, nil }