Define a plugin compiler.

This commit is contained in:
jregan
2019-04-07 11:16:50 -07:00
committed by Jeffrey Regan
parent 1623f1e4c0
commit 175c754f61
9 changed files with 259 additions and 107 deletions

View File

@@ -77,12 +77,13 @@ func loadAndConfigurePlugin(
fileName string, res *resource.Resource) (Configurable, error) {
goPlugin, err := plugin.Open(fileName)
if err != nil {
return nil, fmt.Errorf("plugin %s file not opened", fileName)
return nil, errors.Wrapf(err, "plugin %s fails to load", fileName)
}
symbol, err := goPlugin.Lookup(kplugin.PluginSymbol)
if err != nil {
return nil, fmt.Errorf(
"plugin %s doesn't have symbol %s", fileName, kplugin.PluginSymbol)
return nil, errors.Wrapf(
err, "plugin %s doesn't have symbol %s",
fileName, kplugin.PluginSymbol)
}
c, ok := symbol.(Configurable)
if !ok {