The generated symbol tables carried 25 hand-added nil guards across three
packages, re-applied by hand after every regeneration because `yaegi extract`
does not emit them. Regeneration silently dropped them, and three package docs
instructed the next agent to put them back.
The guards also answered the wrong way. A nil WResolve returned ("", nil), so a
malformed secret engine served an empty secret and reported success; a nil
WStop reported a clean shutdown for a module that never ran one.
Reject the wrapper where it enters the daemon instead. Yaegi type-checks
"var X Iface = impl{}" and refuses an incomplete impl on its own, but the
wrapper type is exported into the symbol table, so interpreted code can build
one directly and struct-literal semantics leave the omitted method nil.
Resolve now names the missing method and skips the plugin.
Generated tables are used verbatim again. Also names the wanted type on a
failed assertion, which formatted as "want <nil>" for every interface target.
66 lines
2.4 KiB
Go
66 lines
2.4 KiB
Go
// Code generated by 'yaegi extract github.com/samcharles93/archie-core/internal/plugin'. DO NOT EDIT.
|
|
|
|
package pluginextract
|
|
|
|
import (
|
|
"context"
|
|
"github.com/samcharles93/archie-core/internal/plugin"
|
|
"go/constant"
|
|
"go/token"
|
|
"reflect"
|
|
)
|
|
|
|
func init() {
|
|
Symbols["github.com/samcharles93/archie-core/internal/plugin/plugin"] = map[string]reflect.Value{
|
|
// function, constant and variable definitions
|
|
"AdaptLegacy": reflect.ValueOf(plugin.AdaptLegacy),
|
|
"HostAPIVersion": reflect.ValueOf(constant.MakeFromLiteral("\"1.0.0\"", token.STRING, 0)),
|
|
"LoadDir": reflect.ValueOf(plugin.LoadDir),
|
|
"NewHost": reflect.ValueOf(plugin.NewHost),
|
|
|
|
// type definitions
|
|
"CapabilityKind": reflect.ValueOf((*plugin.CapabilityKind)(nil)),
|
|
"Host": reflect.ValueOf((*plugin.Host)(nil)),
|
|
"Manifest": reflect.ValueOf((*plugin.Manifest)(nil)),
|
|
"Module": reflect.ValueOf((*plugin.Module)(nil)),
|
|
"Permission": reflect.ValueOf((*plugin.Permission)(nil)),
|
|
"Plugin": reflect.ValueOf((*plugin.Plugin)(nil)),
|
|
|
|
// interface wrapper definitions
|
|
"_Module": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_plugin_Module)(nil)),
|
|
"_Plugin": reflect.ValueOf((*_github_com_samcharles93_archie_core_internal_plugin_Plugin)(nil)),
|
|
}
|
|
}
|
|
|
|
// _github_com_samcharles93_archie_core_internal_plugin_Module is an interface wrapper for Module type
|
|
type _github_com_samcharles93_archie_core_internal_plugin_Module struct {
|
|
IValue interface{}
|
|
WManifest func() plugin.Manifest
|
|
WStart func(a0 context.Context) error
|
|
WStop func(a0 context.Context) error
|
|
}
|
|
|
|
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Manifest() plugin.Manifest {
|
|
return W.WManifest()
|
|
}
|
|
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Start(a0 context.Context) error {
|
|
return W.WStart(a0)
|
|
}
|
|
func (W _github_com_samcharles93_archie_core_internal_plugin_Module) Stop(a0 context.Context) error {
|
|
return W.WStop(a0)
|
|
}
|
|
|
|
// _github_com_samcharles93_archie_core_internal_plugin_Plugin is an interface wrapper for Plugin type
|
|
type _github_com_samcharles93_archie_core_internal_plugin_Plugin struct {
|
|
IValue interface{}
|
|
WName func() string
|
|
WVersion func() string
|
|
}
|
|
|
|
func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Name() string {
|
|
return W.WName()
|
|
}
|
|
func (W _github_com_samcharles93_archie_core_internal_plugin_Plugin) Version() string {
|
|
return W.WVersion()
|
|
}
|