Load package dynamically

Pepeluis picture Pepeluis · Jul 8, 2014 · Viewed 27.7k times · Source

Is it possible to load a specific package during runtime? I want to have a kind of plugins where each one has the same functions than the others but with different behaviour, and depending on the configuration file, load one or other.

Answer

OneOfOne picture OneOfOne · Jul 8, 2014

No, Go doesn't support dynamically loaded libraries.

Your best bet is to start the plugin as its own executable and communicate with it through sockets or via stdin/stdout.

2017 update

This answer is no longer true, Go now supports plugins.