From 4f8c2a3aaf377573d53e9f16de873a765fc796b1 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 10 Jan 2014 01:34:50 -0600 Subject: [PATCH] Move missing config file warn just before return. The warning about a missing config file should only be shown after all other configuration has succeeded so it's not shown when there are invalid options specified. Also add a comment about it where its intended placement is for the future. --- config.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 }