From 01983eb7b5fc553e6ca7ed713ff1c07b0234059b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 20 Jan 2020 21:37:28 +0100 Subject: Introduce PluginLoaderFunc This allows registered plugins to execute code when loaded. This will also allow the Lua support code to be a plugin. Closes: https://todo.sr.ht/~sircmpwn/koushin/54 --- plugin_go.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugin_go.go') diff --git a/plugin_go.go b/plugin_go.go index 34abeeb..9a6bb64 100644 --- a/plugin_go.go +++ b/plugin_go.go @@ -132,3 +132,10 @@ func (p *GoPlugin) Inject(name string, f InjectFunc) { func (p *GoPlugin) Plugin() Plugin { return &goPlugin{p} } + +// Loader returns a loader function for this plugin. +func (p *GoPlugin) Loader() PluginLoaderFunc { + return func(*Server) ([]Plugin, error) { + return []Plugin{p.Plugin()}, nil + } +} -- cgit v1.2.3-59-g8ed1b