Load package dynamically

You might consider executing the ‘plugin’ packages at runtime, by writing out a new program (say, to a temp directory) and executing via exec.Command, something along the lines of exec.Command("go", "run", files…).Run()

You’ll see some similar code here.


There is support for this now as of go 1.8

https://golang.org/pkg/plugin/


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 (for Linux and MacOS only as of June 2021)