Commit f4ea1721 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

NilBuilderFactory

parent 11644251
...@@ -31,3 +31,10 @@ type Builder interface { ...@@ -31,3 +31,10 @@ type Builder interface {
type BuilderFactory interface { type BuilderFactory interface {
CreateBuilder(name string) Builder CreateBuilder(name string) Builder
} }
// This implements BuilderFactory to return nil for every builder.
type NilBuilderFactory byte
func (NilBuilderFactory) CreateBuilder(name string) Builder {
return nil
}
...@@ -51,6 +51,7 @@ type EnvironmentConfig struct { ...@@ -51,6 +51,7 @@ type EnvironmentConfig struct {
// be used to create a new enviroment with NewEnvironment with sane defaults. // be used to create a new enviroment with NewEnvironment with sane defaults.
func DefaultEnvironmentConfig() *EnvironmentConfig { func DefaultEnvironmentConfig() *EnvironmentConfig {
config := &EnvironmentConfig{} config := &EnvironmentConfig{}
config.BuilderFactory = new(NilBuilderFactory)
config.Ui = &ReaderWriterUi{os.Stdin, os.Stdout} config.Ui = &ReaderWriterUi{os.Stdin, os.Stdout}
return config return config
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment