package support import ( "plugin" "git.fsdpf.net/go/contracts" ) func GoPluginCore(core string, services ...any) { p, err := plugin.Open(core) if err != nil { panic(err) } for i := 0; i < len(services); i++ { switch s := services[i].(type) { case map[string]contracts.Controller: if f, err := p.Lookup("RegControllers"); err != nil { panic(err) } else if fn, ok := f.(func(map[string]contracts.Controller) error); ok { fn(s) } case map[string]contracts.ResListener: if f, err := p.Lookup("RegListens"); err != nil { panic(err) } else if fn, ok := f.(func(map[string]contracts.ResListener) error); ok { fn(s) } case map[string]contracts.GRpc: if f, err := p.Lookup("RegGRpcs"); err != nil { panic(err) } else if fn, ok := f.(func(map[string]contracts.GRpc) error); ok { fn(s) } case map[string]contracts.Job: if f, err := p.Lookup("RegJobs"); err != nil { panic(err) } else if fn, ok := f.(func(map[string]contracts.Job) error); ok { fn(s) } case map[string]contracts.Cron: if f, err := p.Lookup("RegCrons"); err != nil { panic(err) } else if fn, ok := f.(func(map[string]contracts.Cron) error); ok { fn(s) } } } if f, err := p.Lookup("Run"); err != nil { panic(err) } else if fn, ok := f.(func()); ok { fn() } }