MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / ValidateService

Function ValidateService

pkg/service/service.go:427–449  ·  view source on GitHub ↗
(serviceName string, svcObj any)

Source from the content-addressed store, hash-verified

425}
426
427func ValidateService(serviceName string, svcObj any) error {
428 svcType := reflect.TypeOf(svcObj)
429 if svcType.Kind() != reflect.Ptr {
430 return fmt.Errorf("service object %q must be a pointer", serviceName)
431 }
432 svcType = svcType.Elem()
433 if svcType.Kind() != reflect.Struct {
434 return fmt.Errorf("service object %q must be a ptr to struct", serviceName)
435 }
436 for idx := 0; idx < svcType.NumMethod(); idx++ {
437 method := svcType.Method(idx)
438 if strings.HasSuffix(method.Name, "_Meta") {
439 err := validateServiceMetaMethod(serviceName, method)
440 if err != nil {
441 return err
442 }
443 }
444 if err := validateServiceMethod(serviceName, method); err != nil {
445 return err
446 }
447 }
448 return nil
449}
450
451func ValidateServiceMap() error {
452 for svcName, svcObj := range ServiceMap {

Callers 1

ValidateServiceMapFunction · 0.85

Calls 2

validateServiceMethodFunction · 0.85

Tested by

no test coverage detected