-
Notifications
You must be signed in to change notification settings - Fork 4
/
empty_container.go
41 lines (33 loc) · 1.05 KB
/
empty_container.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package loader
import (
"fmt"
)
// emptyModuleConfigContainer implements ModuleContainer interface.
// It is used internally when a nil ConfigContainer is returned so that
// the logic can be simpler by not having to treat this scenario separately.
type emptyModuleConfigContainer struct {
configKey string
moduleKind ModuleKind
}
func newEmptyModuleConfigContainer(configKey string, moduleKind ModuleKind) ConfigContainer {
return &emptyModuleConfigContainer{
configKey: configKey,
moduleKind: moduleKind,
}
}
func (container *emptyModuleConfigContainer) ConfigKey() string {
return container.configKey
}
func (container *emptyModuleConfigContainer) ModuleKind() ModuleKind {
return container.moduleKind
}
func (container *emptyModuleConfigContainer) PromptUserForConfig() error {
fmt.Println("Nothing to configure here!")
return nil
}
func (container *emptyModuleConfigContainer) Marshal() (interface{}, error) {
return struct{}{}, nil
}
func (container *emptyModuleConfigContainer) Unmarshal(unmarshal func(interface{}) error) error {
return nil
}