Basic plugin system with centralized registry

This commit is contained in:
2020-11-17 09:19:15 +01:00
parent fe90d81b5d
commit ad5c02bd80
13 changed files with 333 additions and 1 deletions

View File

@ -0,0 +1,11 @@
package main
import (
"context"
"gitlab.com/wpetit/goweb/plugin"
)
func RegisterPlugin(ctx context.Context) (plugin.Plugin, error) {
return &MyPlugin{}, nil
}

View File

@ -0,0 +1,19 @@
package main
import "log"
type MyPlugin struct{}
func (e *MyPlugin) PluginName() string {
return "my.plugin"
}
func (e *MyPlugin) PluginVersion() string {
return "0.0.0"
}
func (e *MyPlugin) HookInit() error {
log.Println("MyPlugin initialized !")
return nil
}