mirror of
https://github.com/jlelse/GoBlog
synced 2024-06-14 11:47:10 +00:00
26 lines
747 B
Go
26 lines
747 B
Go
package plugins
|
|
|
|
import (
|
|
"errors"
|
|
"reflect"
|
|
|
|
"github.com/traefik/yaegi/interp"
|
|
)
|
|
|
|
// PluginHost manages the plugins.
|
|
type PluginHost struct {
|
|
// Plugins contains a list of the plugins.
|
|
Plugins []*plugin
|
|
// PluginTypes is a list of plugins types that plugins have to use at least one of.
|
|
PluginTypes map[string]reflect.Type
|
|
// Symbols is the map of symbols generated by yaegi extract.
|
|
Symbols interp.Exports
|
|
}
|
|
|
|
var (
|
|
// ErrInvalidType is returned when the plugin type specified by the plugin is invalid.
|
|
ErrInvalidType = errors.New("invalid plugin type")
|
|
// ErrValidatingPlugin is returned when the plugin fails to fully implement the interface of the plugin type.
|
|
ErrValidatingPlugin = errors.New("plugin does not implement type")
|
|
)
|