mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 08:25:43 +03:00
Use minimum OS specific path.
This change ensures LoadConfig and LoadConfigDir report consistent paths to files and those paths use the appropriate path separator for the target OS. Note that LoadConfigDir constructs paths with filepath.Join, which calls filepath.Clean, which calls filepath.FromSlash.
This commit is contained in:
@@ -613,7 +613,7 @@ func LoadConfig(path string) (*Config, error) {
|
||||
if fi.IsDir() {
|
||||
return LoadConfigDir(path)
|
||||
}
|
||||
return LoadConfigFile(path)
|
||||
return LoadConfigFile(filepath.Clean(path))
|
||||
}
|
||||
|
||||
// LoadConfigString is used to parse a config string
|
||||
|
||||
@@ -327,7 +327,7 @@ func TestConfig_LoadConfigsFileOrder(t *testing.T) {
|
||||
config := config1.Merge(config2)
|
||||
|
||||
if !reflect.DeepEqual(config.Files, expected) {
|
||||
t.Errorf("Loaded configs don't match\nExpected\n%+vGot\n%+v\n",
|
||||
t.Errorf("Loaded configs don't match\nwant: %+v\n got: %+v\n",
|
||||
expected, config.Files)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user