mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
config: dir on Config should be an absolute path
This commit is contained in:
parent
f8836290da
commit
e96fe43814
@ -104,6 +104,12 @@ func LoadDir(root string) (*Config, error) {
|
||||
root)
|
||||
}
|
||||
|
||||
// Determine the absolute path to the directory.
|
||||
rootAbs, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result *Config
|
||||
|
||||
// Sort the files and overrides so we have a deterministic order
|
||||
@ -141,7 +147,7 @@ func LoadDir(root string) (*Config, error) {
|
||||
}
|
||||
|
||||
// Mark the directory
|
||||
result.Dir = root
|
||||
result.Dir = rootAbs
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
@ -164,7 +164,11 @@ func TestLoadDir_basic(t *testing.T) {
|
||||
t.Fatal("config should not be nil")
|
||||
}
|
||||
|
||||
if c.Dir != dir {
|
||||
dirAbs, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if c.Dir != dirAbs {
|
||||
t.Fatalf("bad: %#v", c.Dir)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user