From 65115cd8a2cba5dce93876d97306d42b4b9d7542 Mon Sep 17 00:00:00 2001 From: mt <375477717@qq.com> Date: Fri, 12 Jul 2024 15:13:50 +0800 Subject: [PATCH] Update service.go --- server/service.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/service.go b/server/service.go index 75b69313..2a62d81e 100644 --- a/server/service.go +++ b/server/service.go @@ -59,6 +59,16 @@ func isExportedOrBuiltinType(t reflect.Type) bool { return isExported(t.Name()) || t.PkgPath() == "" } +func (s *Server) ListServices() []string { + s.serviceMapMu.RLock() + defer s.serviceMapMu.RUnlock() + var arr []string + for name := range s.serviceMap { + arr = append(arr, name) + } + return arr +} + // Register publishes in the server the set of methods of the // receiver value that satisfy the following conditions: // - exported method of exported type