Simplify plugin loader code.

* use one place to build plugin file names,
 * use one loader instance,
 * test for plugin enabled flag in just one place to
   avoid errors and reduce if statements,
 * don't return private objects,
 * factor goplugin loading to a method,
 * fix a related test that was commented out.
This commit is contained in:
jregan
2019-04-21 16:12:55 -07:00
committed by Jeffrey Regan
parent c9bf70fd4b
commit 76a3179868
13 changed files with 169 additions and 154 deletions

View File

@@ -62,8 +62,7 @@ func DefaultSrcRoot() (string, error) {
}
nope = append(nope, root)
root = filepath.Join(
pgmconfig.ConfigRoot(), plugin.PluginRoot)
root = plugin.DefaultPluginConfig().DirectoryPath
if FileExists(root) {
return root, nil
}