More test fixes

This commit is contained in:
Kovid Goyal
2023-02-24 20:09:21 +05:30
parent 22ea33182a
commit dc938cf3dd
3 changed files with 22 additions and 12 deletions

View File

@@ -371,7 +371,7 @@ func (self *ConfigSet) line_handler(key, val string) error {
return c.Parse(key, val)
}
func load_config(hostname_to_match string, username_to_match string, overrides []string, paths ...string) (*Config, error) {
func load_config(hostname_to_match string, username_to_match string, overrides []string, paths ...string) (*Config, []config.ConfigLine, error) {
ans := &ConfigSet{all_configs: []*Config{NewConfig()}}
p := config.ConfigParser{LineHandler: ans.line_handler}
if len(paths) == 0 {
@@ -380,13 +380,13 @@ func load_config(hostname_to_match string, username_to_match string, overrides [
paths = utils.Filter(paths, func(x string) bool { return x != "" })
err := p.ParseFiles(paths...)
if err != nil && !errors.Is(err, fs.ErrNotExist) {
return nil, err
return nil, nil, err
}
if len(overrides) > 0 {
err = p.ParseOverrides(overrides...)
if err != nil {
return nil, err
return nil, nil, err
}
}
return config_for_hostname(hostname_to_match, username_to_match, ans), nil
return config_for_hostname(hostname_to_match, username_to_match, ans), p.BadLines(), nil
}