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