diff --git a/config.go b/config.go index f3f58fb88..2c5c784da 100644 --- a/config.go +++ b/config.go @@ -487,13 +487,6 @@ func loadConfig() (*config, []string, error) { cfg.ConnectPeers = normalizeAddresses(cfg.ConnectPeers, activeNetParams.peerPort) - // Warn about missing config file after the final command line parse - // succeeds. This prevents the warning on help messages and invalid - // options. - if configFileError != nil { - btcdLog.Warnf("%v", configFileError) - } - cfg.dial = net.Dial cfg.lookup = net.LookupIP if cfg.Proxy != "" { @@ -535,6 +528,13 @@ func loadConfig() (*config, []string, error) { } } + // Warn about missing config file only after all other configuration is + // done. This prevents the warning on help messages and invalid + // options. Note this should go directly before the return. + if configFileError != nil { + btcdLog.Warnf("%v", configFileError) + } + return &cfg, remainingArgs, nil }