config/module: proper name for root
This commit is contained in:
parent
46c1209c92
commit
97da02c368
|
@ -10,6 +10,9 @@ import (
|
||||||
"github.com/hashicorp/terraform/config"
|
"github.com/hashicorp/terraform/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RootName is the name of the root tree.
|
||||||
|
const RootName = "root"
|
||||||
|
|
||||||
// Tree represents the module import tree of configurations.
|
// Tree represents the module import tree of configurations.
|
||||||
//
|
//
|
||||||
// This Tree structure can be used to get (download) new modules, load
|
// This Tree structure can be used to get (download) new modules, load
|
||||||
|
@ -100,7 +103,7 @@ func (t *Tree) Modules() []*Module {
|
||||||
// tree and then the module name given for any children.
|
// tree and then the module name given for any children.
|
||||||
func (t *Tree) Name() string {
|
func (t *Tree) Name() string {
|
||||||
if t.name == "" {
|
if t.name == "" {
|
||||||
return "<root>"
|
return RootName
|
||||||
}
|
}
|
||||||
|
|
||||||
return t.name
|
return t.name
|
||||||
|
|
|
@ -75,7 +75,7 @@ func TestTreeName(t *testing.T) {
|
||||||
tree := NewTree("", testConfig(t, "basic"))
|
tree := NewTree("", testConfig(t, "basic"))
|
||||||
actual := tree.Name()
|
actual := tree.Name()
|
||||||
|
|
||||||
if actual != "<root>" {
|
if actual != RootName {
|
||||||
t.Fatalf("bad: %#v", actual)
|
t.Fatalf("bad: %#v", actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,6 @@ func TestTreeValidate_notLoaded(t *testing.T) {
|
||||||
|
|
||||||
|
|
||||||
const treeLoadStr = `
|
const treeLoadStr = `
|
||||||
<root>
|
root
|
||||||
foo
|
foo
|
||||||
`
|
`
|
||||||
|
|
Loading…
Reference in New Issue