configs: NewEmptyConfig function
This is useful for creating a valid placeholder configuration, but not much else. Most callers should use BuildConfig to build a configuration that actually has something in it.
This commit is contained in:
parent
c07b0a7806
commit
2eba023537
|
@ -73,6 +73,17 @@ type Config struct {
|
|||
Version *version.Version
|
||||
}
|
||||
|
||||
// NewEmptyConfig constructs a single-node configuration tree with an empty
|
||||
// root module. This is generally a pretty useless thing to do, so most callers
|
||||
// should instead use BuildConfig.
|
||||
func NewEmptyConfig() *Config {
|
||||
ret := &Config{}
|
||||
ret.Root = ret
|
||||
ret.Children = make(map[string]*Config)
|
||||
ret.Module = &Module{}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Depth returns the number of "hops" the receiver is from the root of its
|
||||
// module tree, with the root module having a depth of zero.
|
||||
func (c *Config) Depth() int {
|
||||
|
|
Loading…
Reference in New Issue