This commit is contained in:
crusader 2018-04-17 19:58:42 +09:00
parent b8ad668263
commit af7be47293

View File

@ -8,8 +8,8 @@ import (
type Service interface { type Service interface {
InitService() error InitService() error
StartService() error StartService() error
StopService() error StopService()
DestroyService() error DestroyService()
} }
type ServiceMethodType int type ServiceMethodType int
@ -73,8 +73,13 @@ func ExecServices(services []interface{}, method ServiceMethodType, orderedTypes
iv := reflect.ValueOf(i) iv := reflect.ValueOf(i)
m := iv.MethodByName(method.String()) m := iv.MethodByName(method.String())
rvs := m.Call([]reflect.Value{}) rvs := m.Call([]reflect.Value{})
if nil != rvs && 1 == len(rvs) && nil != rvs[0].Interface() {
return rvs[0].Interface().(error) switch method {
case ServiceMethodInit, ServiceMethodStart:
if nil != rvs && 1 == len(rvs) && nil != rvs[0].Interface() {
return rvs[0].Interface().(error)
}
default:
} }
} }