resources: Check that resource kind is set.

This could be a Fatal instead, but might as well fail gracefully.
This commit is contained in:
James Shubin
2016-10-18 14:05:23 -04:00
parent 1b3b4406ff
commit 1c1e8127d8

View File

@@ -175,6 +175,9 @@ func (obj *BaseUUID) Reversed() bool {
// Init initializes structures like channels if created without New constructor. // Init initializes structures like channels if created without New constructor.
func (obj *BaseRes) Init() error { func (obj *BaseRes) Init() error {
if obj.kind == "" {
return fmt.Errorf("Resource did not set kind!")
}
obj.events = make(chan event.Event) // unbuffered chan size to avoid stale events obj.events = make(chan event.Event) // unbuffered chan size to avoid stale events
return nil return nil
} }