Ignore config in current directory by default.

Fixes #415.
This commit is contained in:
Josh Rickmar 2016-04-18 11:10:16 -04:00
parent 7b2e1ac282
commit c82b8bae20

View file

@ -222,21 +222,11 @@ func loadConfig() (*config, []string, error) {
DataDir: defaultAppDataDir,
}
// A config file in the current directory takes precedence.
exists, err := cfgutil.FileExists(defaultConfigFilename)
if err != nil {
fmt.Fprintln(os.Stderr, err)
return nil, nil, err
}
if exists {
cfg.ConfigFile = defaultConfigFile
}
// Pre-parse the command line options to see if an alternative config
// file or the version flag was specified.
preCfg := cfg
preParser := flags.NewParser(&preCfg, flags.Default)
_, err = preParser.Parse()
_, err := preParser.Parse()
if err != nil {
if e, ok := err.(*flags.Error); !ok || e.Type != flags.ErrHelp {
preParser.WriteHelp(os.Stderr)