I'm looking for an equivalent of Architect for the Go language.
With Architect, modules expose "plugins". Plugins can specify dependencies, and export an API to allow interaction with other plugins. To start an application instance, you specify a list of plugins. Dependencies are resolved, and plugins are loaded (instantiated) in order.
Since each application creates a single instance of each plugin, multiple applications can be started in the same process without colliding.
Edit: I don't need the other modules to be loaded dynamically.
I don't of a package that does that, but have some thoughts on how to do that - hope it'll help.
Have Registry
and Plugin
interfaces, probably something like:
type Registry {
// Register registers a plugin under name
Register(name string, plugin *Plugin) error
// Get plugin by name
Get(name string) (*Plugin, error)
}
// Global Registry
var GlobalRegistry Registry
type Plugin interface {
// Init is called upon plugin initialization. Will be in dependency order
Init(reg Registry) error
// Execute plugin command
Exec(name string, args... interface{}) (interface{}, error)
}
go build -tags plugin1,plugin2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With