chore: Nested if can be replaced with else-if
This commit is contained in:
parent
56d0eb0e6a
commit
f34deb0eac
|
@ -270,13 +270,11 @@ func LoadConf(confPath string) (ConfYaml, error) {
|
|||
// If a config file is found, read it in.
|
||||
if err := viper.ReadInConfig(); err == nil {
|
||||
fmt.Println("Using config file:", viper.ConfigFileUsed())
|
||||
} else {
|
||||
} else if err := viper.ReadConfig(bytes.NewBuffer(defaultConf)); err != nil {
|
||||
// load default config
|
||||
if err := viper.ReadConfig(bytes.NewBuffer(defaultConf)); err != nil {
|
||||
return conf, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Core
|
||||
conf.Core.Address = viper.GetString("core.address")
|
||||
|
|
Loading…
Reference in New Issue