lib: add plugin support

This enables loading plugins from RCLONE_PLUGIN_PATH if set.
This commit is contained in:
Richard Patel 2019-09-23 02:41:02 +02:00 committed by Nick Craig-Wood
parent 349112df6b
commit 44b603d2bd
4 changed files with 93 additions and 1 deletions

16
lib/plugin/package.go Normal file
View file

@ -0,0 +1,16 @@
// Package plugin implements loading out-of-tree storage backends
// using https://golang.org/pkg/plugin/ on Linux and macOS.
//
// If the $RCLONE_PLUGIN_PATH is present, any Go plugins in that dir
// named like librcloneplugin_NAME.so will be loaded.
//
// To create a plugin, write the backend package like it was in-tree
// but set the package name to "main". Then, build the plugin with
//
// go build -buildmode=plugin -o librcloneplugin_NAME.so
//
// where NAME equals the plugin's fs.RegInfo.Name.
package plugin
// Build for plugin for unsupported platforms to stop go complaining
// about "no buildable Go source files".