Remove unreachable code
This commit is contained in:
parent
ffc50af67e
commit
df83060c30
@ -27,19 +27,21 @@ func Get() *Config {
|
|||||||
func readConfigurationFile(fileName string) (*Config, error) {
|
func readConfigurationFile(fileName string) (*Config, error) {
|
||||||
if bytes, err := ioutil.ReadFile(fileName); err == nil {
|
if bytes, err := ioutil.ReadFile(fileName); err == nil {
|
||||||
// file exists, so we'll parse it and return it
|
// file exists, so we'll parse it and return it
|
||||||
return parseConfigBytes(bytes), nil
|
return parseConfigBytes(bytes)
|
||||||
} else {
|
} else {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &Config{}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseConfigBytes(yamlBytes []byte) (config *Config) {
|
func parseConfigBytes(yamlBytes []byte) (config *Config, err error) {
|
||||||
yaml.Unmarshal(yamlBytes, &config)
|
err = yaml.Unmarshal(yamlBytes, &config)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, service := range config.Services {
|
for _, service := range config.Services {
|
||||||
if service.Interval == 0 {
|
if service.Interval == 0 {
|
||||||
service.Interval = 10 * time.Second
|
service.Interval = 10 * time.Second
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return config
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user