config: simplify some returns

This commit is contained in:
Alberto Cortés 2017-09-26 16:57:56 +02:00
parent 398fa4fd02
commit bb3dad9cba
1 changed files with 6 additions and 24 deletions

View File

@ -463,10 +463,7 @@ func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err := unmarshal((*plain)(c)); err != nil {
return err
}
if err := checkOverflow(c.XXX, "TLS config"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "TLS config")
}
// ServiceDiscoveryConfig configures lists of different service discovery mechanisms.
@ -508,10 +505,7 @@ func (c *ServiceDiscoveryConfig) UnmarshalYAML(unmarshal func(interface{}) error
if err := unmarshal((*plain)(c)); err != nil {
return err
}
if err := checkOverflow(c.XXX, "service discovery config"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "service discovery config")
}
// HTTPClientConfig configures an HTTP client.
@ -630,10 +624,7 @@ func (c *AlertingConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
if err := unmarshal((*plain)(c)); err != nil {
return err
}
if err := checkOverflow(c.XXX, "alerting config"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "alerting config")
}
// AlertmanagerConfig configures how Alertmanagers can be discovered and communicated with.
@ -1085,10 +1076,7 @@ func (c *KubernetesNamespaceDiscovery) UnmarshalYAML(unmarshal func(interface{})
if err != nil {
return err
}
if err := checkOverflow(c.XXX, "namespaces"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "namespaces")
}
// GCESDConfig is the configuration for GCE based service discovery.
@ -1469,10 +1457,7 @@ func (c *RemoteWriteConfig) UnmarshalYAML(unmarshal func(interface{}) error) err
return err
}
if err := checkOverflow(c.XXX, "remote_write"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "remote_write")
}
// QueueConfig is the configuration for the queue used to write to remote
@ -1529,8 +1514,5 @@ func (c *RemoteReadConfig) UnmarshalYAML(unmarshal func(interface{}) error) erro
return err
}
if err := checkOverflow(c.XXX, "remote_read"); err != nil {
return err
}
return nil
return checkOverflow(c.XXX, "remote_read")
}