go-scopes/config/config.go

39 lines
567 B
Go

package config
type Cfg struct {
*BaseConfig
ConfigFormat string
}
// definitions
type Config interface {
Name() string
Children() []Config
Add(Config)
}
type BaseConfig struct {
name string
children []Config
}
func (cfg *BaseConfig) Name() string {
return cfg.name
}
func (cfg *BaseConfig) Children() []Config {
return cfg.children
}
func (cfg *BaseConfig) Add(child Config) {
cfg.children = append(cfg.children, child)
}
func MakeBase(name string) *BaseConfig {
return &BaseConfig{name: name}
}
func Setup(cfg Config) Config {
return cfg
}